π‘οΈ Sentinel: Fix command injection in git utils #22
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.
π‘οΈ Sentinel: [CRITICAL/HIGH] Fix command injection vulnerability in git utils
π¨ Severity: CRITICAL
π‘ Vulnerability: Command Injection in
src/utils/git.ts. The functionssearchCommitsandgetCommitInfowere usingchild_process.execwith interpolated strings containing user input (query,hash). This allowed arbitrary command execution if a malicious string was provided (e.g. via a manipulated search query).π― Impact: An attacker could execute arbitrary commands on the victim's machine by tricking them into searching for a malicious string or viewing a crafted commit hash.
π§ Fix: Replaced
exec(which spawns a shell) withexecFile(which executes the binary directly). Arguments are now passed as an array, preventing shell interpretation of special characters.β Verification: Created a reproduction script that confirmed the injection was possible with the old code. Updated unit tests (
src/utils/__tests__/git.spec.ts) to verify thatexecFileis called with the correct array arguments and ran them successfully.PR created automatically by Jules for task 14733649975977161046 started by @kratos06
Summary by cubic
Fixes a critical command injection in git utils by switching from exec to execFile and passing safe argument arrays. Prevents shell interpretation of user input in commit search and info commands.
Written for commit 85c51dd. Summary will update on new commits.