Repository navigation
TD-5305: the sandbox's egress proxy and its audit rows - #131
Merged
Merged
Conversation
sandboxing.md R3, first PR of two (signed off ahead of the work): an asyncio HTTP proxy for CONNECT and plain http:// with no listener of its own. A request needs the command's own token (407 otherwise); the host must be on the grant's list from boundary.network (a bare name is ports 80 and 443, an IP literal only when listed); the proxy resolves names itself, refuses loopback, link-local and own-host answers, and dials the address it checked. Plain HTTP is one request per connection. Every allow and deny is a network_egress audit row (schema v8) with the tool call id. Nothing uses it yet: TD-5306 adds the setting and the bridge from inside the sandbox's network namespace. Network stays off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Full sandbox (owner brief section 4), design sandboxing.md R3. This is PR 1 of 2 as agreed: the proxy and audit first, then the bridge in TD-5306. Nothing uses the proxy yet, and network stays fully off. TD-5306 adds the setting (off by default) and the bridge from inside the bubblewrap network namespace.
core/tstd/sandbox/proxy.pyis an asyncio proxy forCONNECTand plainhttp://, with no SOCKS, no TLS interception and no new dependency. It has no listener of its own: the daemon hands it one connection at a time. On Linux that will be over a socket pair, so nothing on the host listens.ProxyGranttoken, read from BasicProxy-Authorization. A missing, wrong or revoked token gets 407 and nothing is dialled. One command's token never carries another's grant.boundary.network). A bare name allows ports 80 and 443;host:portallows that port. An IP literal must itself be listed.Connection: close, so a second request cannot name an unchecked host.Audit: every allow and deny becomes a row in the new append-only
network_egresstable (schema v8): tool call id, host, port, the address dialled, verdict and reason. No traffic or URL path is kept. An audit failure neither opens nor hangs the connection.Prime directive §2.3: the proxy is added to
test_outbound_hosts.py's outbound-capable set with its reason: it dials only hosts the person listed, for a command they ran.Groundwork for TD-5306, checked on this Linux machine with the product's real seccomp filter, inside
bwrap --unshare-all:socket(AF_UNIX)is still refused;So design option 1, keeping the filter as it is, works.
Tests:
test_sandbox_proxy.py(new). It contacts no outside host: the allowed host is a local server reached through a connect seam from an RFC 5737 test address. Full core suite: 9062 passed. The one failure, the outbound-hosts confinement test, is fixed in this PR. ruff and mypy are clean. Release scan: 0 hits.🤖 Generated with Claude Code