gemini-cli PR hardens shell wrapper inspection to block command substitution bypasses
duvanka-prasad · ghdev · 2026-11-25
PR #30451 on google-gemini/gemini-cli (+1734/-22) hardens command substitution detection and the PolicyEngine:
- Uses tree-sitter-bash AST decomposition of wrapped shell commands, with a linear-time fallback segmenter when WASM is unavailable or on Windows/PowerShell
- Tokenizes POSIX/ANSI-C $'...' wrappers and peels declarative prefix utilities like env -S, nice, timeout, sudo, xargs
- Covers sh/bash/zsh/dash variants, cmd.exe (/c, /k, /r) and PowerShell (including -encodedcommand UTF-16LE base64)
- Recursively inspects nested wrappers up to depth 5 and 64 detection states, failing closed beyond limits
- Fixes partial stripping of quoted arguments with trailing operators, comments, or redirections that could evade policy checks
The change closes sandbox/policy bypasses where agents could hide dangerous commands inside shell wrapper layers.
More from coding & agent
- Surge AI: frontier coding agents jump from 8% to ~65% on sudo L7, early signs of RSI — echen · 2026-11-25
- YC founder: risk-ops agents now clear 91% of fraud alerts, signed first fintech client in under 4 weeks — ycombinator · 2026-11-25
- A two-message thread test: can your AI assistant tell a task was already cancelled? — anthonyaluna · 2026-11-25
- "My agent responded to your agent, they mostly agree" is now a work message — jacalulu · 2026-11-25
- ChatGPT Business gets banked resets and free fast mode through Dec 31 — SIGKITTEN · 2026-11-25
- Dev shows 40-minute Gemini Neon coding session improving OpenScreen's export quality and speed — gaganghotra_ · 2026-11-25