Repository navigation
[AI-1663] Sandbox proxy broker under Daytona netleash: tunnel allowed domains, CA per run - #1113
Merged
Merged
Conversation
…, fit Daytona's netleash (WIP, oversize) - egress proxy: a CONNECT to one of the config's allowed domains (Record.Allowed) on 443 gets a blind TCP tunnel through internal/egress.DialPublic: no MITM, no token, nothing logged; granted hosts keep MITM + substitution, a host both granted and allowed is a grant's; anything else 403. - broker: the proxy URL with its credential goes to Daytona alone (OutboundProxyUrl); the sandbox env holds placeholders only; CA env vars (+ CURL_CA_BUNDLE) move to Mount.RunEnv, sent on every ExecuteCommand (WithCommandEnv) and CodeRun (CodeRunParams.Env); the bundle starts from /etc/daytona/netleash/ca.crt when present. A record keeps the allowed domains once every grant is withdrawn. - daytona: DomainAllowList = grants' hosts + config domains, never the proxy host; NO_PROXY and the proxy-in-CIDR path removed. session: network_allow_list refused with broker proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x code has root Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ends Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…box-proxy-netleash
…nding a tunnel and a withdrawn grant on an allowed host Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ntial grants with allowed domains Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… netleash reaching the proxy unverified Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the allow list Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tleash bypass Co-Authored-By: Claude Sonnet 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.
Linear: AI-1663 — the
proxysandbox broker (#1104) did not work under Daytona's netleash (staging E2E 2026-10-21). This PR fits it: Daytona forces egress through netleash by allow list, netleash holds the proxy credential, the proxy tunnels allowed domains blind and terminates TLS only for a grant's host.Flow
sequenceDiagram participant S as Daytona sandbox (code, root) participant N as Daytona netleash participant P as Router egress proxy (internal/sandbox/egress) participant H as Host S->>N: CONNECT host:443 (HTTPS_PROXY = netleash) Note over N: DomainAllowList = grants' hosts ∪ allowed_domains<br/>other names: 403 / not resolved N->>P: CONNECT host:443 + Proxy-Authorization (OutboundProxyUrl userinfo) alt host a grant covers P->>S: TLS with router CA (sandbox trusts it via per-run CA env) P->>H: request, placeholder → token (resolved per request) H->>P: response P->>S: response, token → placeholder else host of allowed_domains only P->>H: dial (public addresses only, else 502) P-->>S: bytes as they are: no TLS of ours, no token, nothing read else any other host / IP literal / port ≠ 443 P->>S: 403 endWhat changed
Probe facts (our Daytona org, 2026-10-21, sandboxes deleted)
EnvVarslose)ExecuteCommand+WithCommandEnvwinsCodeRun+CodeRunParams.Envwins (all 5 CA vars ours)HTTPS_PROXY=http://172.20.0.1:18080, no userinfo/etc/daytona/netleash/ca.crtread-only bind mount: Mozilla roots + netleash CAOutboundProxyUrlalone forces nothing;DomainAllowListforces (direct :443 intercepted, other names 403)OutboundProxyUrlrefuses blocked ranges; accepts hostname + userinfoRules → tests
TestOnlyAnAllowedDomainOnPort443IsTunnelledTestAnAllowedDomainIsTunnelledAsItIsTestAHostBothGrantedAndAllowedIsAGrantsTestAnAllowedDomainResolvingToANonPublicAddressIsNotDialedTestATunnelToAnAllowedDomainKeepsTheTLSHelloAndEndsWithTheHostTestTheRecordHoldsTheConfigsAllowedDomainsTestTheBundleHoldsTheSandboxsRootsAndTheCATestTheProviderHoldsTheProxyCredentialAndEveryRunTrustsTheCATestTheSandboxGoesThroughTheProxyToItsGrantsAndAllowedDomainsnetwork_allow_list/ open network refused with broker proxyTestTheProxyBrokerRefusesAConfigItCannotServeTestTheProxyBrokerSendsTheSandboxThroughTheProxyTestATunnelToAnAllowedDomainEndsWithTheSandboxTestAHostWithATrailingDotIsTheHostWithout*,*.,..,*.*) is skippedTestTheRecordHoldsTheConfigsAllowedDomainsTestAGrantWithdrawnOnAnAllowedHostEndsItsOpenTunnelTestClosingEndsTheCredentialOfARecordWithAllowedDomainsTestNoGrantWithACredentialGivesNoProxyWhateverIsAllowedTestAGrantTheBrokerLeavesOutIsNotInTheAllowListTestDaytonasBrokerSendsDaytonaWhatItDidBeforeAll 29 mutations killed.
Suites:
go test -tags integration -p 1on internal/sandbox/..., internal/session, internal/config, cmd/router: pass. Full run: only known base failures (ChatLogins, SessionVerbs, TurnRecording) and internal/store hitting the 10 m default timeout in TestShardedStoreSuite (package untouched).Rulings (orchestrator; Kanat may overturn)
proxy,network_allow_listis refused at session start: the proxy reaches hosts by name only.Unverified
OutboundProxyUrl(CONNECT chaining) — staging E2E, AI-1663 point 4.🤖 Generated with Claude Code