Claude Code --restricted: an agent that can't run code
Claude Code v2.1.248 added a restricted mode that strips Bash, code execution, and WebFetch. The containment flag we have been asking for, shipped.
Anthropic shipped a Claude Code restricted mode on August 27 in v2.1.248. One flag, --restricted, removes the tools that make a coding agent dangerous. We wrote yesterday about a prompt injection chain that turned "summarize this website" into remote code execution. This is the other half of that conversation.
What actually happened
From the Claude Code changelog, --restricted (or CLAUDE_CODE_RESTRICTED=1) does four things: it removes the built-in tools that run commands or code and WebFetch unless you explicitly name them in --tools, it keeps file tools inside the working directory, it refuses bypassPermissions, and it ignores user, project, and local settings files.
That last item is the one people will skip past. Ignoring settings files means a repo you just cloned cannot hand the agent a .claude/settings.json that quietly re-enables what you turned off. The flag is not a preference the environment can argue with.
The same release train hardened the file tools directly. v2.1.251 lists fixes for file-tool symlink vulnerabilities and plugin path traversal — the class of bug where a link inside a repo points somewhere your working directory does not cover.
Why a restricted agent matters for your business
This is the first Claude Code control that survives a hostile repo. Permission prompts, allowlists, and auto-mode classifiers all run inside a session that untrusted content is actively trying to steer. A flag that deletes the tool before the session starts cannot be talked out of it. Different security model entirely.
Use it as the default for anything reading code you did not write. Client repos during a discovery audit, dependency review, incident triage on a codebase you inherited, any agent pointed at a pull request from outside your org. Read-and-reason work does not need Bash. Give it --restricted and add back a named tool only when the task genuinely requires one.
It does not replace the sandbox. Restricted mode removes tools; it does not contain what remains. File tools still read every file in the working directory, and the model still sends what it reads to an API. Secrets in .env are still secrets in .env. Layer the flag on top of a container and an egress allowlist — the flag is the inner ring, not the wall.
Key takeaways
--restrictedshipped in Claude Code v2.1.248 on August 27, 2026- It strips command/code execution and
WebFetchunless named in--tools - File tools are pinned to the working directory and
bypassPermissionsis refused - User, project, and local settings files are ignored, so a cloned repo cannot re-enable tools
- v2.1.251 fixed file-tool symlink and plugin path-traversal issues in the same area
- Still not a sandbox: the agent reads everything in scope and sends it to an API
Most teams have no default agent posture — every session gets every tool. We set up coding-agent workflows with tiered permissions: restricted for reading unknown code, sandboxed and scoped for anything that writes. See how we build agent systems, or tell us what your agents can currently execute.
Sources: Claude Code CHANGELOG.
- #claude-code
- #ai-agents
- #sandboxing
- #prompt-injection
- #dev-tools
Tommy Rush — Founder, Rush Commerce
Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More
Get The Rush Report weekly — one email, zero fluff.
Keep reading
Unitree G1 root RCE over Bluetooth, no pairing needed
CVE-2026-76640 chains an open BLE write, a cleartext key, and a cloud API with no ownership check into wormable root on a humanoid robot. The bug class is in your hardware too.
Read itTeamPCP arrests won't rotate your CI credentials
Australian police charged two alleged TeamPCP members over supply chain attacks that hit 1,000+ organizations and half a million credentials. Arrests are not remediation.
Read it