Execution gate for untrusted repository commands and MCP tool calls
Security teams testing Claude Code, Codex, or MCP-based agents should add a pre-execution gate before any command, binary, script, file path, URL, database query, or terminal tool call that came from repository text or user-controlled input. The gate can be simple: label the source of each proposed argument, block auto-approved execution for unsigned local binaries and repo-suggested scripts, require a human approval reason for first-time commands, and log the exact repository file or MCP parameter that introduced the instruction.
The need is concrete. One proof of concept modified a local geopy repository with normal-looking project guidance, a security.sh script, a malicious code_policies binary, and a decoy source file. Claude Code and Codex inspected the files, accepted the script as safe, and ran the malicious binary in auto-mode or auto-review. The reported affected setups included several Claude Code CLI versions and Codex CLI 0.142.4.
MCP servers show the same class of failure at tool boundaries. SpellSmith’s MCP study found 43 taint-style cases among 53 vulnerability reports, with most triggered during tool invocation. Its mitigation rewrites tool descriptions with security guidance and adds a reflection step before final execution. A practical first test is to run existing agents against a small repo fixture with benign-looking README guidance that asks for a script execution, then repeat with the gate enabled and check whether the agent can still inspect code while losing the path to automatic execution.
Sources
- Document 1794
- Document 1799