Skip to content
Rush Commerce
Software & Dev3 min read

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

  • --restricted shipped in Claude Code v2.1.248 on August 27, 2026
  • It strips command/code execution and WebFetch unless named in --tools
  • File tools are pinned to the working directory and bypassPermissions is 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
TR

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.