feat(agent): add Docker sandbox backend for agent run - #42
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…s for configuration
…mplement related logic
… manage proxy settings and firewall rules
… holder functionality
…sure network isolation
…fficial native installers, ensuring proper permissions and symlink setup for non-root users
…ERM and COLORTERM environment variables for improved terminal capabilities
…sandbox profile, enforcing mutual exclusivity and validation checks
…es to include necessary OAuth and authentication endpoints
…box, detailing custom image support, network egress enforcement, and command overrides
…res, including network isolation, filesystem access, and custom image support
…ner handling and reduced curl timeout for firewall verification
…on and network setup to enhance clarity during startup
… including cleanup of leftover networks and containers
…g in sandbox management
…pport loading profiles from global, directory, or auto-detected sources
…ent commands, detailing session tracing and network handling
…and pip support, enabling package installation and isolated environments
…stallation in the default Docker image, clarifying package management capabilities in the sandbox environment
…verifying CLI availability, daemon reachability, and image status
…t option for structured JSON responses
…nsuring accurate validation and reporting for Docker backend environments
…r enhanced security and consistency across platforms
…llowing users to specify memory and CPU allocations for enhanced control over resource usage
…sing --init and setting a pids-limit of 2048
…orm support and image availability checks
…ation in Docker sandbox documentation
…reads in Docker sandbox to avoid character device confusion
…box to prevent root ownership of mounted files on Linux
…ure platform compatibility
…tform compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in Docker sandbox backend for
agent run— a stronger alternative to the native Seatbelt/systemd-run/bubblewrap backend, running the agent inside an isolated container instead of a same-host sandboxed process.Key properties:
iptablesdefault-DROP rules, then verifies they actually took effect before trusting them), not by the agent choosing to honorHTTPS_PROXY/HTTP_PROXY. Verified this holds under a real adversarial bypass attempt (raw socket to an arbitrary host, and an attempt to flush the firewall from inside the agent container — both fail as designed). DNS gets no exception at all, closing a data-exfiltration channel that no per-container firewall rule could otherwise block (Docker's embedded resolver forwards unresolved lookups via the host's own DNS stack, outside the container's network namespace entirely).--cap-drop ALL,no-new-privileges,--init(proper zombie reaping/signal handling), and a--pids-limit(fork-bomb containment) — always on, no configuration needed.Configurability:
[sandbox] image/dockerfile— run a custom image or build one from a project-supplied Dockerfile, for anything beyond the maintained default (Claude Code + Codex pre-installed, plus common tooling including Python). None of the sandbox constraints above can be loosened by a custom image.[sandbox] memory/cpus— optional resource caps (opt-in, no default, since an automatic cap could silently break a legitimate heavy task).--docker-sandbox,--docker-image,--docker-dockerfile,--docker-memory,--docker-cpus.agent dockercommand group:build,status,cleanup(finds and removes leftover containers/networks from a crashed run — every resource is named after its own session id, so it's traceable),doctor(readiness check without starting a real sandboxed run).Also included:
agent validatenow checks Docker readiness instead of native-backend mechanisms for a Docker-backend profile, so it doesn't falsely report Windows as unsupported for a profile that doesn't need the native backend at all.Testing
Known limitations
config.rs) since it was blocking this branch's CI, but it isn't part of the Docker sandboxing feature itself.