🔒 [security] Replace insecure exec with execFile in git and discovery utils - #16
🔒 [security] Replace insecure exec with execFile in git and discovery utils#16alexj11324 wants to merge 1 commit into
Conversation
… utils This commit addresses a potential command injection vulnerability by replacing `child_process.exec` (via `execAsync`) with `child_process.execFile` (via `execFileAsync`) when executing shell commands. Specifically: - In `out/utils/git.js`, `isGitRepo` and `getCurrentBranch` now use `execFileAsync` with argument arrays. - In `out/antigravityClient/discovery.js`, the `execCommand` helper now always uses `execFileAsync`. - All `execAsync` definitions have been removed from these files to prevent future insecure usage. Verification: - Created custom Node.js test scripts using `child_process` mocks to ensure commands are executed with the correct arguments and that `execFile` is used instead of `exec`. - Verified that the logic still works as expected across simulated platforms.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The vulnerability fixed is the use of
child_process.execfor executing shell commands, which is susceptible to command injection if arguments are not properly sanitized. This was replaced withchild_process.execFile.🛡️ Solution: By using
execFileand passing arguments as an array, the OS treats the arguments as data rather than shell tokens, effectively neutralizing command injection attacks. All instances ofexecAsyncinout/utils/git.jsandout/antigravityClient/discovery.jswere replaced.PR created automatically by Jules for task 8107190670202250280 started by @alexj11324