🛡️ Sentinel: Fix command injection vulnerability in git utils #28
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: HIGH
💡 Vulnerability:
child_process.execwas used to execute git commands with user-controlled input (e.g., commit hash, search query), which could allow command injection if the input contained shell metacharacters.🎯 Impact: Attackers could potentially execute arbitrary commands on the host machine if they can influence the git operations (e.g., via a malicious branch name or search query).
🔧 Fix: Replaced
execwithexecFileand passed arguments as an array. This bypasses the shell and prevents the arguments from being interpreted as commands. Also fixed argument quoting forexecFilecompatibility.✅ Verification: Ran
pnpm test utils/__tests__/git.spec.ts. Verified thatgitcommands are executed correctly and that tests pass with the new implementation.PR created automatically by Jules for task 9115698132810581293 started by @kratos06
Summary by cubic
Fixes a command injection vulnerability in git utils by switching from exec to execFile and using safe argument arrays. Prevents arbitrary command execution through user-controlled inputs like commit hashes and search queries.
Written for commit f6929ff. Summary will update on new commits.