Skip to content

fix: prevent command injection in git-changes-commit-message tool#8

Open
123mutouren321414 wants to merge 1 commit into
hypermodel-labs:mainfrom
123mutouren321414:fix-command-injection
Open

fix: prevent command injection in git-changes-commit-message tool#8
123mutouren321414 wants to merge 1 commit into
hypermodel-labs:mainfrom
123mutouren321414:fix-command-injection

Conversation

@123mutouren321414
Copy link
Copy Markdown

Replace child_process.exec with execFile to avoid shell interpretation.

The previous implementation executed cd ${cwd} and git commands using child_process.exec, which allows shell metacharacters in user-controlled input (autoCommitPath) to be interpreted by the shell.

This change:

  • removes the unsafe cd ${cwd} shell call
  • replaces exec with execFile
  • executes git commands using argument arrays

This prevents command injection while preserving the original functionality.

Replace child_process.exec with execFile to avoid shell interpretation.

The previous implementation executed `cd ${cwd}` and git commands using
child_process.exec, which allows shell metacharacters in user-controlled
input (autoCommitPath) to be interpreted by the shell.

This change:
- removes the unsafe `cd ${cwd}` shell call
- replaces exec with execFile
- executes git commands using argument arrays

This prevents command injection while preserving the original functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant