Skip to content

Enforce the sandbox network cap - #888

Merged
SaladDay merged 2 commits into
mainfrom
enforce-the-sandbox-network-cap
Oct 27, 2026
Merged

SaladDay merged 2 commits into
mainfrom
enforce-the-sandbox-network-cap

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

  • Protocol: NetworkSupport{Restrict, PrivateDomains} in DeploymentPolicy; Egress{Public, PrivateDomains, Endpoints} in Bootstrap and ResumeRequest. Docs EN and zh.
  • Deployment spec network{public, domains}: default {true, []}; exact host names only, at most 100, stored lowercase, deduplicated and sorted. The format rule is authored once in Go (sandbox/network.go) and projected to the node installer (node_spec.py) and deployment-contract.ts by the contract generator. Validation against the Provider declaration returns invalid_sandbox_configuration with param network.public or network.domains. Migration 000010 adds the default to stored specifications.
  • API: POST/PUT /core/v1/sandbox/deployment accept network; every view returns specification.network. Omitted on POST is the default; omitted on PUT keeps the stored cap (not on first setup).
  • Core derives one Egress at Create and Resume (execution/network_egress.go): {Public, PrivateDomains: cap.domains, Endpoints: [model provider host, loopback skipped]}. MCP hosts are not added; MCP follows the policy. The disabled/restricted rejection is unchanged.
  • microsandbox: the helper builds the rules per sandbox, at Create and at every Resume, in the agreed interim order (host DNS, deny loopback/link-local/metadata, allow Core on its port, port-less allow of resolved private addresses of Endpoints and PrivateDomains, deny private, domain allows when not Public, allow public). Rebind protection stays at its default and no DNS option is set. Unresolved names get no rule and the node logs them. deploy/node/host_microsandbox.py no longer resolves Core or writes rules.
  • E2B: declares Restrict only. Public gives deny_out for loopback, private and link-local ranges; not Public gives deny_out: [0.0.0.0/0] plus allow_out: [Core host, Endpoints]. The documented SDK semantic is that allow_out wins over deny_out; I did not probe a real account.
  • Docker adapter files are untouched (zero NetworkSupport).

Verification

  • go build ./... && go vet ./... in services/core; go test for sandbox, api, deployment, execution, persistence, cmd and the integration suite (local PostgreSQL); helper module GOWORK=off go vet and the rule tests (the other helper tests need the SDK FFI bundle that this checkout lacks).
  • Python: deploy/node unit tests, tools/e2b-provider provider tests.
  • pnpm typecheck for agents-client and apps/web, vitest for both. make openapi regenerated.
  • The website translation test needs vitepress for its structure check; hashes were updated for six zh files.

Deviations and limits

  • Out of scope as briefed: Web UI, Domains, wildcard suffixes, Docker, microsandbox sources.
  • Stored node specification digests change with the migration; nodes of an earlier installation are reinstalled.
  • Names resolve when a sandbox starts or resumes; a later change of an answer is not followed.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@blacksmith-sh

This comment has been minimized.

@SaladDay
SaladDay force-pushed the enforce-the-sandbox-network-cap branch from 5f83eb9 to f48a48f Compare October 27, 2026 17:52
Add the deployment network cap (public, exact private domains), the Provider NetworkSupport declaration and the Egress that Core sends at Create and Resume. microsandbox and E2B enforce it in their adapters; the node installer no longer writes network rules.
@SaladDay
SaladDay merged commit d2b589d into main Oct 27, 2026
25 checks passed
@SaladDay
SaladDay deleted the enforce-the-sandbox-network-cap branch October 27, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant