Skip to content

Potential fix for code scanning alert no. 7: Unsafe shell command constructed from library input - #15

Merged
akabarki76 merged 1 commit into
mainfrom
alert-autofix-7
Jul 22, 2025
Merged

Potential fix for code scanning alert no. 7: Unsafe shell command constructed from library input#15
akabarki76 merged 1 commit into
mainfrom
alert-autofix-7

Conversation

@akabarki76

Copy link
Copy Markdown
Owner

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 } in spawn, 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 remove shell: true from the spawn options in openDiff. No other code changes are required, since arguments are already being passed as an array.
Additionally, the import for shell-quote on line 8 is unused and can be safely removed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…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
akabarki76 marked this pull request as ready for review July 22, 2025 02:37
@akabarki76
akabarki76 merged commit bd27045 into main Jul 22, 2025
1 of 6 checks passed
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