The proxy includes built-in protection against destructive shell commands (especially around git and the filesystem) and against several high-risk shell idioms (remote download piped into a shell or interpreter, broad process termination, and similar patterns). The goal is to stop agents from running commands that could destroy work, leak data, or take down processes.
This safety feature detects and blocks dangerous operations before they are forwarded to tooling that runs shell commands. Detection is pattern-based on the command string, with a normalization pass applied first so common obfuscations are less effective:
- ANSI terminal escapes (CSI / OSC sequences) are stripped so color codes cannot hide tokens.
- NUL bytes are removed.
- Unicode NFKC normalization reduces fullwidth / compatibility-form homoglyphs that could otherwise dodge simple matchers.
After normalization, the proxy matches against a combined set of rules (fast path) and detailed per-rule metadata for logging and steering messages.
Note: Developer tools like linters, formatters, and type checkers (ruff, black, mypy, eslint, etc.) are automatically exempted from dangerous command detection. See Developer Tool Exemptions for details.
- Pattern-Based Detection: Uses regex patterns for destructive git/filesystem commands and selected remote-execution / process-control patterns
- Normalization Before Matching: Strips ANSI escapes, NULs, and applies Unicode NFKC to harden against trivial obfuscation
- Real-Time Blocking: Intercepts dangerous commands at the tool call level
- Comprehensive Coverage: Blocks many destructive git operations plus additional shell-risk patterns (examples below)
- Descriptive Feedback: Returns clear messages explaining why commands were blocked
- Safer Alternatives: Suggests safer alternatives when appropriate
- Audit Logging: Logs all blocked attempts for debugging and security auditing
Git and repository safety (non-exhaustive):
git reset --hard(discards all local changes)git clean -f(deletes untracked files)git push --force(overwrites remote history)git branch -D(force deletes branches)git restore .(discards unstaged changes)git filter-branch/ history-rewriting flows- And many more destructive operations enforced via the shared pattern set
Additional shell-risk patterns (illustrative; the exact set evolves with releases):
- Interpreter heredocs (
python/perl/ruby/nodewith<<) often used to smuggle multi-line payloads curl/wgetpiped intobash/shor into an interpreter (python,ruby, …), including somecurl … -O - | …formschmodmake-executable then./run chainskillwith$(pgrep …),kill -9 -1, aggressivepkill -9- Classic fork-bomb form
- Redirects toward sensitive locations such as
/etc/or/dev/sd-style device paths
The same rules apply whether you use the legacy dangerous-command handler or the unified tool security path; both consume the shared configuration and normalization pipeline.
Configuration follows precedence: CLI > Environment > Config File
# Disable protection (overwrites config file and environment variable)
--disable-dangerous-git-commands-protection# Enable or disable protection
export DANGEROUS_COMMAND_PREVENTION_ENABLED=true # or false# config.yaml
session:
dangerous_command_prevention_enabled: true# Protection is enabled by default
python -m src.core.cli --default-backend openai# Only disable if you understand the risks
python -m src.core.cli --disable-dangerous-git-commands-protectionexport DANGEROUS_COMMAND_PREVENTION_ENABLED=true
python -m src.core.cliexport DANGEROUS_COMMAND_PREVENTION_ENABLED=false
python -m src.core.cliWhen a dangerous git command is detected, the proxy:
- Blocks the tool call execution
- Returns a descriptive steering message explaining why the command was blocked
- Logs the blocked attempt for debugging and security auditing
- Suggests safer alternatives when appropriate
# These commands will be blocked:
git reset --hard HEAD
git clean -f
git push --force origin main
git restore .
git branch -D feature-branch
git filter-branch --prune-empty- Prevent Accidental Data Loss: Stop LLM agents from accidentally destroying work
- Repository Safety: Protect repository history from destructive operations
- Team Collaboration: Prevent force pushes that could affect other team members
- Development Safety: Add a safety net during automated development workflows
- Learning Environments: Protect students and learners from destructive mistakes
Only disable this protection if you:
- Understand the risks of the specific commands you need to execute
- Have legitimate reasons to execute these commands
- Have proper backups and recovery procedures in place
- Are working in an isolated or test environment
Note: This protection is enabled by default for security. Exercise caution when disabling it.
- Outbound URL safety - SSRF-style validation for SSO and catalog HTTP fetches
- Tool Access Control - Fine-grained control over tool execution
- File Access Sandboxing - Restrict file operations to project directory
- Inline Python Steering - Prevent unstable inline Python execution
- Quality Verifier System - Real-time response verification