techlist.io

Bubblewrap

1 posts

Anthropic2025-10-203 min readCurated summary

Making Claude Code safer with sandboxing

Anthropic's Claude Code can edit files, run commands, and navigate a codebase, which creates real risk when it is exposed to prompt injection. To address this, Anthropic introduced two features built on sandboxing: a sandboxed bash tool that lets Claude run commands without a permission prompt for each action, and Claude Code on the web, which runs each session in an isolated cloud sandbox. Anthropic reports that sandboxing reduced internal permission prompts by 84%, showing that defined boundaries can improve both security and autonomy. ## The Problem with Permission Prompts - By default, Claude Code is read-only and asks for approval before modifying files or running most commands. Only safe commands such as `echo` and `cat` are auto-allowed. - Constant approval requests slow development and cause "approval fatigue," where users stop scrutinizing what they approve, which makes development less safe. ## Sandboxing: Fixed Boundaries Instead of Per-Action Approval Sandboxing sets pre-defined limits within which Claude can act freely. It is built on operating system features and enforces two kinds of isolation: - **Filesystem isolation:** Claude can access only specific directories, which prevents a prompt-injected agent from modifying sensitive system files. - **Network isolation:** Claude can connect only to approved servers, which prevents data leaks and malware downloads. Anthropic stresses that both are required. Network isolation alone lets a compromised agent exfiltrate files such as SSH keys, and filesystem isolation alone lets it escape the sandbox and reach the network. ## Sandboxed Bash Tool - Anthropic released the sandbox runtime in beta as an open-source research preview. It restricts which directories and network hosts a process can use, without the overhead of containers, and can wrap arbitrary processes, agents, and MCP servers. - In Claude Code, the runtime sandboxes the bash tool. Commands run without prompts inside the limits, and any attempt to go outside them triggers a notification so the user can allow or deny it. - It is built on Linux bubblewrap and macOS seatbelt, so restrictions apply to subprocesses and scripts the command spawns, not just Claude's direct actions. - Filesystem access allows reads and writes in the current working directory and blocks modifications elsewhere. - Network access goes only through a Unix domain socket to a proxy running outside the sandbox. The proxy enforces domain allowlists, asks the user to confirm new domains, and can be customized with arbitrary outbound rules. - Both the file paths and domains are configurable. Users enable the feature with `/sandbox`. ## Claude Code on the Web - Each session runs in an isolated cloud sandbox with full access to its own server. - Sensitive credentials, such as git credentials and signing keys, never enter the sandbox, so compromised code cannot easily cause further harm. - A custom proxy handles all git operations. Inside the sandbox, git authenticates with a scoped credential. The proxy checks that the credential is valid and that the operation matches the allowed scope (for example, pushing only to the configured branch), then attaches the real token before forwarding the request to GitHub. ## Recommendation Developers who use Claude for engineering work can run `/sandbox` in Claude Code to reduce prompts while improving safety, or try Claude Code on the web at claude.com/code. Teams building their own agents can also adopt the open-sourced sandboxing code.