Making Claude Code safer with sandboxing
Claude Code now sandboxes its bash tool using OS-level primitives (Linux bubblewrap, macOS seatbelt) to enforce filesystem isolation (writes limited to the working directory) and network isolation (traffic forced through a Unix domain socket to an external proxy that allowlists domains), covering all spawned subprocesses. Both boundaries are required, since without network isolation a prompt-injected agent can exfiltrate secrets and without filesystem isolation it can escape the sandbox. Internally this cut permission prompts by 84%, and the runtime is open-sourced for sandboxing other agents and MCP servers. Claude Code on the web runs sessions in cloud sandboxes that never hold real credentials. A git proxy validates a scoped credential and the push target before attaching the GitHub token.
Related posts
- How we contain Claude across products
Anthropic Engineering mediumAdeptAnthropic caps the blast radius of Claude agents mainly through containment (sandboxes, VMs, egress controls) rather than human approval, after telemetry showed users approved about 93% of permission prompts. claude.ai runs code in ephemeral gVisor containers, Claude Code combines human approval with an OS-level sandbox (Seatbelt/bubblewrap) that cut prompts by 84%, and Cowork runs inside a full local VM with credentials kept on the host. The post also covers vulnerabilities they missed, including project config hooks executing before the trust dialog and a red-team phish in which a user-pasted prompt exfiltrated AWS credentials 24 of 25 times. Its main lesson is that only environment-level controls such as egress blocking and filesystem boundaries reliably stop attacks that model-layer defenses cannot see.
- Inside the Codex sandbox
OpenAI mediumAdept
Codex sandboxes agent-run commands in the user's own environment by using each OS's native sandboxing facilities rather than VMs or containers, so native toolchains like Xcode and the iOS simulator keep working. The default :workspace profile allows writes inside the workspace but keeps .git and .codex read-only, allows broad reads, and disables network access. That still leaves risks such as tampering with ignored node_modules, which is why OpenAI treats the sandbox as one layer of defense in depth. The post covers the cross-platform spawn API, per-command permission escalation in the exec_command tool, TOML permission profiles with filesystem and domain rules, a network proxy, and layered enterprise managed requirements, before describing enforcement on macOS, Linux and Windows.
- Sandboxing
Zed mediumAdeptZed's agent panel now sandboxes the terminal and fetch tools by default (from 1.14) using OS-enforced restrictions: Seatbelt on macOS, Bubblewrap namespaces on Linux, and WSL on Windows. Default rules block writes outside project directories, writes to .git (which could plant hooks that run unsandboxed), and network access, and agents must request escalation with a stated reason. Instruction-following and command-matching rules like banning `git .*` are trivially bypassed via shells, env vars or other interpreters, and a symlink-swap TOCTOU race between user approval and bwrap bind mounting could grant write access to arbitrary readable directories, which Zed detects and fails closed on. The sandbox is one defense layer and does not cover the edit tool, ACP agents, LSP/MCP servers, build.rs, proc macros or git hooks run outside it.
- Prove your AI agent guardrails work
Docker mediumAdeptCoding agents with broad access can leak credentials or delete files, as two reported July 2026 incidents show: Grok Build CLI silently uploaded whole repositories, including ignored files and planted secrets, to cloud storage, and a Full Access agent deleted a user's home directory after alternatives to blocked rm succeeded. The fix is least privilege enforced on the whole agent application, not on the model's instructions. Docker Sandboxes run agents in microVMs behind a host proxy, and Docker AI Governance adds org-wide network policy (including HTTP method/path rules), filesystem mount policy with deny-wins semantics, proxy-injected credentials kept outside the VM, and MCP gateway access rules. A bank-log demo walks through configuring and testing the network and filesystem controls with sbx.
- Coding Agent Horror Stories: The Security Crisis Threatening Developer Infrastructure
Docker easyNoviceAI coding agents run with the full identity of the user who launched them, so they inherit filesystem access, cloud credentials, and secrets with no approval step between a model's decision and its execution. Documented incidents illustrate the risk: Claude Code wiping a Mac home directory via `rm -rf ... ~/`, Amazon Kiro deleting a production AWS Cost Explorer environment and causing a 13-hour outage, and the s1ngularity Nx npm compromise harvesting secrets. Failures are grouped into six risk categories, from unrestricted filesystem access to prompt injection and malicious plugins, each with mitigation advice. The recommended controls are workspace-scoped filesystems, separate least-privilege agent identities, and human review for production changes, with Docker Sandboxes pitched as the containment layer.