Potential fix for code scanning alert no. 7: Unsafe shell command constructed from library input - #15
Merged
Merged
Conversation
…structed from library input Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Mustapha BARKI <code4yo@gmail.com>
akabarki76
marked this pull request as ready for review
July 22, 2025 02:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/akabarki76/gemini-cli/security/code-scanning/7
The best way to fix this problem is to avoid using
{ shell: true }inspawn, unless it is absolutely necessary. When{ shell: true }is not used, Node.js will pass each argument to the executable as a separate argument, eliminating the risk of shell interpretation and command injection. For GUI-based editors like VS Code, there is no need to use the shell unless the command relies on shell features (pipes, redirection, etc.), which is not the case here. Thus, we should removeshell: truefrom thespawnoptions inopenDiff. No other code changes are required, since arguments are already being passed as an array.Additionally, the import for
shell-quoteon line 8 is unused and can be safely removed.Suggested fixes powered by Copilot Autofix. Review carefully before merging.