feat: prime host-level allow/block egress lists#2110
Conversation
Replace PrimeConfig.network_access with allow/block egress lists mapped to the new SDK's network_allowlist/network_denylist (VM-only, mutually exclusive, hostname/*./IPv4/CIDR entries). The policy is applied through set_network in prepare_execution — after trusted setup, right before the agent starts — with framework routes (interception, MCP) auto-allowlisted, and the rollout fails closed if the data plane doesn't ack within 60s. cpu/memory/disk now default to None and are only sent when set, deferring to the sandbox SDK defaults. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a013c39. Configure here.
| self.info.id, | ||
| self.config.allow, | ||
| self.config.block, | ||
| ) |
There was a problem hiding this comment.
Missing reuse guard for egress
Medium Severity
prepare_execution applies a lasting host egress policy after trusted setup, but PrimeRuntime never claims the sandbox as single-rollout the way Docker does for the same trusted-setup-then-restrict shape. A box from agent.provision reused across runs keeps the prior agent-phase policy through the next setup, so later setups can run restricted instead of open.
Reviewed by Cursor Bugbot for commit a013c39. Configure here.
ApprovabilityVerdict: Needs human review Unable to check for correctness in a013c39. This PR introduces new network egress control functionality for Prime sandboxes, which is security-sensitive. Additionally, there's an unresolved review comment identifying a potential bug with egress policy persistence across sandbox reuse. Both factors warrant human review. You can customize Macroscope's approvability policy. Learn more. |


Summary
prime-sandboxesto>=0.2.33and adopt its new egress-policy surface:PrimeConfigtakes host-levelallow/blocklists (exact hostnames, leftmost-label*.wildcards, IPv4 addresses/CIDRs) instead of the removednetwork_accessswitch. VM-only and mutually exclusive, validated at config parse by mirroring the SDK contract (validate_egress_lists).set_network) inprepare_execution— after trusted setup, right before the agent starts — matching Docker's trusted-setup-then-restrict shape. Framework routes (interception endpoint, MCP URLs) are auto-allowlisted, soallow = []permits only those. Sinceset_networkonly governs new connections once the data plane acks (applied), the rollout polls for that and fails closed with aSandboxErrorafter 60s rather than starting the agent unrestricted.cpu/memory/disknow default toNoneand are only sent when set, deferring to the sandbox SDK defaults (task-declaredTaskData.resourcesstill apply on top of unset values viaresolve_runtime_config).docs/v1/evaluation.mdgains a "Prime host policies" section; the prime table inskills/evaluate-environments/references/REFERENCE.mdis updated.Breaking
PrimeConfig.network_accessis removed (the field no longer exists in the SDK'sCreateSandboxRequest). Migration:network_access = false→vm = true+allow = [](blocks all agent-phase egress except framework routes);network_access = trueis the default (leaveallow/blockunset).PrimeConfig.cpu/memory/diskdefaults change from1.0/2.0/5.0toNone(unset → SDK defaults, currently the same values). Pin them explicitly to keep provisioning independent of SDK defaults.Verification
Dummy agent rollouts (bash harness in a prime VM sandbox, agent instructed to probe
example.comandgoogle.comand report reachability, reward = report matches the scenario's expected reachability):allow = ["example.com"]SandboxError(policy accepted, neverapplied)allow = []SandboxError(policy accepted, neverapplied)block = ["example.com"]SandboxError(policy accepted, neverapplied)The fail-closed results are a platform-side gap, not an integration bug: direct SDK probes (no verifiers involved) show the egress-policy data plane never converges right now —
applied_generationstays-1for 6+ minutes in both the provider-default andusregions, on both paths:network_allowlist=["example.com"]→ all egress blocked (even the allowlisted host),applied=Falseforever;set_networkon a running VM → policy accepted (generation=1) but egress stays fully open,applied=Falseforever.Given
set_networkis fail-open untilapplied, the 60s ack-wait inprepare_executionis what keeps these rollouts from silently running unrestricted. Once the platform's policy agent ships, the same rollouts should go green with no changes here.🤖 Generated with Claude Code
Note
Medium Risk
Changes sandbox networking and rollout gating (fail-closed on policy apply); breaking config surface for Prime, though behavior aligns with Docker’s post-setup restriction model.
Overview
Prime VM egress replaces the removed
network_accessflag with optional host-levelallow/blocklists (validated at config parse, VM-only, mutually exclusive). Sandboxes still provision with open networking;prepare_executioncallsset_network, auto-prepends interception/MCP route hosts to an allowlist, and polls up to 60s forappliedbefore the agent runs—otherwise it raisesSandboxErrorinstead of starting unrestricted.Provisioning no longer sends
network_accesson create;cpu,memory, anddiskdefault toNoneand are omitted soprime-sandboxes>=0.2.33SDK defaults apply.Docs add a Prime host-policies section in
evaluation.mdand refresh the Prime table in the evaluate-environments reference.Breaking: migrate
network_access=false→vm=true+allow=[]; pin resource fields if you relied on the old fixed defaults.Reviewed by Cursor Bugbot for commit a013c39. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add host-level allow/block egress lists to Prime runtime
network_access: boolfield inPrimeConfigwithallow: list[str] | Noneandblock: list[str] | Nonefields that define host-level egress allow/deny lists, validated at config parse time viaprime_sandboxes.models.validate_egress_lists.PrimeRuntime.prepare_executionwhich applies the egress policy after trusted setup and before the agent starts, automatically prepending framework route hostnames to allow lists and polling until the data plane acknowledges the policy (60s timeout).cpu,memory, anddiskfields now acceptNoneto defer to SDK defaults instead of fixed numeric defaults.prepare_execution, which is a behavioral change from the previousnetwork_accessapproach.Macroscope summarized a013c39.