Sandboxing agentic coding tools like Claude Code requires careful network isolation to prevent secret exfiltration. Using HTTP proxies (like mitmproxy) allows you to intercept API requests and inject credentials outside the sandbox, ensuring Claude Code never has direct access to sensitive API keys. This proxy pattern enables fine-grained access control by routing traffic through intermediaries that can enforce least-privilege policies while maintaining functionality. The approach addresses the security trifecta: limiting external communication, controlling sensitive data access, and managing untrusted content exposure.
Table of contents
Sandboxing agentic coding tools is a networking problemWhat is the worst a sandbox can do?Unpacking the devcontainer firewallUsing network proxies to prevent secrets exfiltration: hiding the ANTHROPIC_API_KEY from Claude CodeTying a developer’s permissions to their Claude Code permissions: proxying Claude Code to the Formal ConnectorWhen hostnames and headers are hard to edit: mitmproy add-onsApplying fine-grained least privilege policies239 Impressions