Skip to content

fix(sandbox): default network to plain allow; stop claiming a metadata-endpoint block - #853

Merged
blove merged 4 commits into
mainfrom
blove/sandbox-network-default-honest
Sep 25, 2026
Merged

blove merged 4 commits into
mainfrom
blove/sandbox-network-default-honest

Conversation

@blove

@blove blove commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

The default sandbox network policy was { mode: "allow", denylist: ["169.254.169.254"] }, but neither reference provider enforces an allow-mode denylist:

  • Docker maps allow mode to --network bridge and never reads the denylist. Deny mode (--network none) also ignores allowlist.
  • Kubernetes emits no per-thread NetworkPolicy in allow mode. Only the b4-sandbox-infra chart's default-deny egress backstop (on by default, and needing a policy-enforcing CNI) blocks the metadata endpoint.

The docs described the default as blocking the cloud metadata endpoint "best-effort", and configuration.mdx said it "denies" it. The endpoint was always reachable from an allow-mode sandbox.

This PR makes the default honest instead of adding enforcement:

  • DEFAULT_NETWORK is now { mode: "allow" }. Runtime behavior is unchanged, because egress was open before and is open now.
  • The SandboxPolicy.network JSDoc and the Docker/Kubernetes provider comments say which lists each provider ignores.
  • docs/sandbox, docs/configuration, the api/workspace field row, and two blog posts now say plainly that allow mode is open egress, metadata endpoint included. They recommend { mode: "deny" }, or a host firewall/egress proxy (Docker) or the chart backstop/NetworkPolicy (Kubernetes).
  • The configuration example allowlist: ["api.openai.com"] was wrong too (Kubernetes takes CIDRs, Docker ignores the list). It's now a CIDR with a note.
  • check-docs.mjs pins updated: the sandbox page now must carry the "not enforced" and "metadata endpoint reachable" sentences instead of "best-effort".
  • Patch changeset for @b4run/cli, @b4run/workspace, @b4run/sandbox. SEO lastmod regenerated.

Test plan

  • New resolve-sandbox.test.ts case asserts the provider receives { mode: "allow" }; confirmed failing against the old default first
  • pnpm lint, pnpm build, pnpm typecheck, pnpm test:release-integrity
  • node scripts/check-docs.mjs, pnpm --dir apps/web test, seo:lastmod:check
  • @b4run/cli, @b4run/workspace, @b4run/sandbox test suites

🤖 Generated with Claude Code

blove and others added 4 commits September 25, 2026 12:55
…a-endpoint block

Neither the Docker nor the Kubernetes provider enforces an allow-mode
denylist, so the default { mode: "allow", denylist: ["169.254.169.254"] }
claimed a block that never happened. Default to { mode: "allow" } and
correct the docs, blog copy, and JSDoc to say plainly that allow mode is
open egress (cloud metadata endpoint included), recommending deny mode or
an egress control outside B4.run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…curacy text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
b4-run Ready Ready Preview Sep 25, 2026 7:56pm UTC

Request Review

@blove
blove enabled auto-merge (squash) September 25, 2026 19:55

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@blove
blove deployed to vercel-preview September 25, 2026 19:55 — with GitHub Actions Active
@blove
blove merged commit 1da86ae into main Sep 25, 2026
31 of 32 checks passed
@blove
blove deleted the blove/sandbox-network-default-honest branch September 25, 2026 20:15

This branch was successfully deployed

2 active deployments
Preview — bf95a28a Deployed Sep 25, 2026 by vercel[bot]
vercel-preview — bf95a28a Deployed Sep 25, 2026 by blove via vercel-native #2414
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