Skip to content

fix: prevent command injection vulnerabilities in install_dependencie…#18

Open
123mutouren321414 wants to merge 1 commit intobazinga012:masterfrom
123mutouren321414:fix-command-injection
Open

fix: prevent command injection vulnerabilities in install_dependencie…#18
123mutouren321414 wants to merge 1 commit intobazinga012:masterfrom
123mutouren321414:fix-command-injection

Conversation

@123mutouren321414
Copy link

…s tool

This change replaces the unsafe use of child_process.execAsync in the install_dependencies tool with execFileAsync and passes command arguments as arrays instead of constructing shell command strings. Previously, the install_dependencies tool built package installation commands by concatenating user-controlled packages into shell command strings such as conda install, pip install, or uv pip install, and then executed them via child_process.execAsync. Because exec invokes commands through a system shell, specially crafted package names could potentially be interpreted as additional commands, leading to command injection.

This update:

replaces child_process.execAsync with execFileAsync

passes installation arguments as arrays instead of interpolated shell command strings

removes shell-based package list construction in install_dependencies

preserves the existing dependency installation behavior across supported environment types

By avoiding shell interpretation of user-controlled package names, this change prevents potential command injection vulnerabilities while maintaining the original functionality of the install_dependencies tool.

…s tool

This change replaces the unsafe use of child_process.execAsync in the install_dependencies tool with execFileAsync and passes command arguments as arrays instead of constructing shell command strings. Previously, the install_dependencies tool built package installation commands by concatenating user-controlled packages into shell command strings such as conda install, pip install, or uv pip install, and then executed them via child_process.execAsync. Because exec invokes commands through a system shell, specially crafted package names could potentially be interpreted as additional commands, leading to command injection.

This update:

replaces child_process.execAsync with execFileAsync

passes installation arguments as arrays instead of interpolated shell command strings

removes shell-based package list construction in install_dependencies

preserves the existing dependency installation behavior across supported environment types

By avoiding shell interpretation of user-controlled package names, this change prevents potential command injection vulnerabilities while maintaining the original functionality of the install_dependencies tool.
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