You configured tool permissions without checking process and resource isolation
In one sentence: Client policies intercept covered calls; OS isolation limits the resources accessible to covered processes. Verify which processes, readable paths, and network routes are inside the boundary, rather than relying on โsandbox enabled.โ
Symptomโ
You enable the built-in sandbox and assume the agent, MCP, and hooks are all isolated. My shell cannot write outside the workspace, but may still read host credentials; an MCP call runs in a separate service. One switch does not describe every execution route.
Why this happensโ
Client policy and OS isolation both enforce controls, but their boundaries differ. The former checks matching tool requests; the latter limits resources for processes inside it. Permissions are not merely advice, and a shell sandbox is not automatically an agent-wide sandbox.
Current Claude Code documentation says its built-in sandbox covers shell commands and their subprocesses. File/web tools, MCP, and hooks run outside it. Default reads still include much of the host, and environment variables may carry credentials. Configure reads, writes, network access, and credentials separately, and inspect processes outside the boundary.
A container or VM can cover a larger process group, but mounts, injected environment variables, host sockets, and credentials change that boundary. Verify directory isolation and read-only credentials in practice.
Consequencesโ
- After injection, an uncovered tool or process may still reach resources.
- Writes are restricted while sensitive reads remain possible; approved destinations may still carry exfiltration.
- Initialization failures, excluded commands, or approved unsandboxed retries widen execution access.
What to do insteadโ
Map execution routes, then verify each route's resource access.
- Identify where shell commands, file tools, MCP, hooks, and helpers run and under which identity. For a shared boundary, place the whole agent and relevant processes in an appropriate container/VM.
- Provide only necessary mounts and credentials; deny sensitive reads, reduce injected environment variables, and restrict egress. Design filesystem and network controls together. Either alone can help, but leaves parts of the attack chain uncovered.
- Inspect excluded commands, unsandboxed retries, and initialization failures. If isolation is required, fail closed rather than silently continue with broader access.
- Use dummy-data probes to check reads, writes, network access, and MCP routes. Record results. A sandbox limits consequences; it does not guarantee prevention of prompt injection.
Exampleโ
Before:
You: The sandbox is on; process this external repository.
Reality: Only shell commands are inside; MCP retains host access; credentials remain injected.
After:
You: Use a disposable environment mounting only this repository, without production credentials.
Verify shell/MCP/hooks are within the intended boundary; permit only necessary destinations.
Me: I check restrictions using test paths and destinations before processing the materials.
When the exception appliesโ
Local, disposable tasks without sensitive data and with limited consequences can use lighter isolation. โRead-onlyโ can still expose secrets, and a task without code execution may still send data through web/MCP tools. Judge reachable resources and tool capabilities; see autonomy approval boundaries.
Tool differencesโ
As of 2026-10-29, CLI, IDE, local, and cloud surfaces cover different processes, and defaults evolve. Do not compare brands only by whether they have a sandbox. Check platform support, reads/writes, network, MCP, hooks, and retry routes. Claude Code's shell boundary is the verified example here, not a promise about other products.
Version notesโ
This entry uses the current shell-sandbox documentation. Recheck platform support, default reads, failures, and retries for the installed version. OS isolation complements least privilege and cannot prevent all damage within its own boundary.
Further reading and sourcesโ
- Configure the sandboxed Bash tool: coverage, defaults, and exceptions.
- Making Claude Code more secure and autonomous with sandboxing: design background.