Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix command blocklist bypass via shell splitting - #308

Closed
bobdivx wants to merge 1 commit into
mainfrom
sentinel/fix-command-blocklist-bypass-1219179541715606041
Closed

bobdivx wants to merge 1 commit into
mainfrom
sentinel/fix-command-blocklist-bypass-1219179541715606041

Conversation

@bobdivx

@bobdivx bobdivx commented Nov 4, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: Command blocklist bypass via trailing spaces. The system relies on string checking (e.g., contains("rm ")) which fails if the sensitive token is the last word in the command string without trailing spaces.
🎯 Impact: Malicious users could execute explicitly forbidden commands by padding or placing them strategically at the end of the argument string.
πŸ”§ Fix: Keep the joined string substring check to preserve existing functionality (e.g., matching multi-word phrases), but additionally loop through individual shell-split tokens and enforce an exact match specifically for rm to prevent trailing space bypasses.
βœ… Verification: Ran cargo test on tools::workdir_cmd and added explicit internal tests validating that rm is successfully blocked regardless of its position in the string.


PR created automatically by Jules for task 1219179541715606041 started by @bobdivx

When a blocklist rule contained a space (like `"rm "`) to prevent false
positives on legitimate commands (like `"format"`), it failed to match if
the blocked token was at the very end of the command string (e.g. `npm run rm`).

This patch tokenizes the command first and enforces exact matches for critical
sensitive commands (like `rm`), while retaining the existing substring check
on the joined command to support multi-word blocks.

Co-authored-by: bobdivx <6737167+bobdivx@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.

@bobdivx

bobdivx commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

Closing: false alarm / overlaps #283 and previously closed #291. rm is not in ALLOWED_BINS, so a bare rm never runs; npm run rm would invoke an npm script name, not the rm binary. The trailing-space contains("rm ") check is intentional to avoid false positives (e.g. farm). Prefer deciding the broader workdir_cmd validation rewrite on #283 rather than stacking another partial patch here.

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