Skip to content

Enforce the microsandbox network cap on the fork runtime - #901

Merged
SaladDay merged 6 commits into
mainfrom
feat/microsandbox-network-n3
Oct 28, 2026
Merged

SaladDay merged 6 commits into
mainfrom
feat/microsandbox-network-n3

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What

microsandbox now enforces the network cap without interims, on create and resume alike:

  • Cap *.example.com: covers the subdomains of example.com at any depth, never example.com itself and never a whole top-level domain (*.com is rejected). The adapter maps each entry to the fork runtime's subdomain-only destination, so the apex stays refused through TLS SNI, the DNS-answer binding and DNS queries. Restricted Session domains stay exact.
  • Restore = create: both run with strict hostname enforcement and DNS rebind protection off, through the fork SDK's create and restore options. The restore policy carries only rules and defaults, the one rule list both paths share.
  • Interims removed: host-side pre-resolution of cap names and their private-address pins (create), and the public-address pins on restore.
  • DNS only through the node: sandboxes reach the node's DNS server; DNS to any other server and every other port of the node are refused, so only the node's answers bind names to addresses.
  • Fork release oac-v0.7.11-2: the Go SDK (go.mod replace), its FFI and the runtime archive (msb built by the fork, the official libkrunfw of v0.7.11) come from one tag, FORK_TAG in scripts/build-microsandbox-provider.py, each pinned by checksum.

Verification

  • make check-microsandbox-provider; go test for internal/sandbox, internal/sandbox/providers, internal/sandbox/microsandbox/..., internal/execution; go vet ./...; deploy/node unit tests; script tests; Web NetworkSettings.test.tsx; specification-contract check; website translations tests 1 and 2 (3 needs vitepress, not installed here).
  • Fork release run green: FFI c04e6256…, runtime archive 9ca514e5…; the archive's libkrunfw.so.5.6.1 is byte-identical to the official v0.7.11 file (3854efcd…).
  • Fresh test install from a checkout bundle of 22eb988 (node payload carries the fork msb), microsandbox node, real Sessions (codex, MiniMax-M2.7):
Case Result (on create and after suspend/resume)
Acceptance codex / claude_sdk 9/9 each; resume first text 0.64–0.95 s
Cap public + intranet GitLab public site 200; GitLab resolves to its private address, API 200, git clone OK; other private, loopback and metadata addresses refused
restricted [example.com] example.com 200, example.org refused
disabled model Turn OK, every other connection refused
Cap public off, *.example.com, *.<intranet domain> example.com refused; TLS with SNI www.example.com to example.com's address refused until www.example.com itself is resolved; www.example.com 200; example.org refused; GitLab through the intranet wildcard API 200, clone OK
Cap public off, GitLab model Turn OK, public sites refused, GitLab API 200, clone OK
DNS to 8.8.8.8 over UDP and TCP answered on the node with NXDOMAIN, no answers; nothing leaves the node; node ports other than 53 refused
Cap *.com (review fix, Core swapped to the PR head) 400 invalid_sandbox_configuration, param network.domains

Node: 25 creates 1.2–1.4 s, 32 suspends 2.9–5.1 s, 9 resumes 0.9–4.6 s, no warnings or errors. Core log: no 5xx, no ERROR, no credential strings.


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

Create and restore both turn off strict hostname enforcement and DNS rebind
protection, so the private pre-resolution and the restore address pins go.
The cap accepts *.example.com for subdomains, enforced as a suffix allow
behind an apex deny.
State the plain-text limit once (sandbox-deployment), note why an Endpoint at
a suffix apex skips the apex deny, and test that the Web accepts *.suffix.
…node

Restore accepts only rules and defaults, so create sets the strict and
rebind options itself. With rebind protection off, a guest-chosen resolver
could bind a cap name to any private address: deny DNS to every server
but the host, and the rest of the host (its loopback).
The fork release oac-v0.7.11-2 adds a subdomain destination that never
matches the apex, through SNI, the DNS cache binding and DNS queries, and
publishes the runtime archive next to the FFI. The adapter maps each cap
*.apex entry to it, so the apex deny and the plain-text limit go.
*.com would allow every .com name on any address it resolves to; the cap
now requires at least two labels after *., as wildcard certificates do.
The helper no longer reports unresolved names, so its stderr parsing keeps
only unsupported endpoints. The distribution build reads the fork tag from
the provider build script.
@blacksmith-sh

This comment has been minimized.

*.example.com is now a valid cap entry; *.com is the invalid one.
@SaladDay
SaladDay merged commit 0eec918 into main Oct 28, 2026
22 checks passed
@SaladDay
SaladDay deleted the feat/microsandbox-network-n3 branch October 28, 2026 13:12
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