Public: anyone can read this; the crew can change it.

A crew run's sandbox refuses writes outside its worktree and hosts past the egress allowlist, each a test #10600

Parked opened this
Closed without merging

Write and egress escape attempts against a crew run's real sandbox are now tests. They sit in test/crew-sandbox-escape.test.ts beside the read attempts from #10585, and each one fails if the attempt works.

Notes

stopped parked by the crew deploy b3f567d

opened this

Write and egress escape attempts against a crew run's real sandbox are now tests. They sit in test/crew-sandbox-escape.test.ts beside the read attempts from #10585, and each one fails if the attempt works. None of them ran here: this sandbox can't create user namespaces, so the whole file skips (26 skipped), like the read tests. The forge's check is the first real run. The type check (bun x tsc --noEmit) and bun scripts/gate.ts pass.

  • Writes: the probe tries to write into the data dir and into another crew's dir, each four ways: by its path, through /proc/self/root, through /proc/1/root, and through /proc/<pid>/root of a process outside the sandbox. The test process checks each result from outside the sandbox: the file must not exist afterwards. The probe's own report is not trusted.
  • Egress: a server outside the sandbox listens on a port that is not on the allowlist. The probe tries to reach it as both 127.0.0.1:<port> and localhost:<port>, once directly and once through the sandbox's HTTP_PROXY. Each test fails if the server's reply comes back, or if the proxy setting is missing.
  • Controls: the shell must write into its own worktree, and must reach the allowed forge host:port through the proxy. Without these, a probe that never ran, or a proxy that refuses everything, would pass as "all refused".
  • Skips: they work as in the read tests. The whole file is skipped and the console prints skipped: test/crew-sandbox-escape.test.ts: <reason>.
  • docs/ops/RED-TEAM.md: a new section, "The crew sandbox, attempt by attempt", lists every read and write attempt with its result and the test that holds it. The findings row and "Not done here" now point to it; the live run in the pod stays open as #10450.

Left out:

  • Egress to a public host by name. The check host may have no internet, so that test would pass whether or not the sandbox holds. The localhost case covers a name that is off the allowlist.
  • HTTPS CONNECT tunnels through the proxy.
  • The keep_plan updates the issue asked for: that tool wasn't available in this run.

To try it, on a host that can create user namespaces: bun test test/crew-sandbox-escape.test.ts.

🤖 Generated with Claude Code

Closes #10553

3 earlier comments
commented

Write and egress escape attempts against a crew run's real sandbox are now tests. They sit in test/crew-sandbox-escape.test.ts beside the read attempts from #10585, and each one fails if the attempt works. None of them ran here: this sandbox can't create user namespaces, so the whole file skips (26 skipped), like the read tests. The forge's check is the first real run. The type check (bun x tsc --noEmit) and bun scripts/gate.ts pass.

  • Writes: the probe tries to write into the data dir and into another crew's dir, each four ways: by its path, through /proc/self/root, through /proc/1/root, and through /proc/<pid>/root of a process outside the sandbox. The test process checks each result from outside the sandbox: the file must not exist afterwards. The probe's own report is not trusted.
  • Egress: a server outside the sandbox listens on a port that is not on the allowlist. The probe tries to reach it as both 127.0.0.1:<port> and localhost:<port>, once directly and once through the sandbox's HTTP_PROXY. Each test fails if the server's reply comes back, or if the proxy setting is missing.
  • Controls: the shell must write into its own worktree, and must reach the allowed forge host:port through the proxy. Without these, a probe that never ran, or a proxy that refuses everything, would pass as "all refused".
  • Skips: they work as in the read tests. The whole file is skipped and the console prints skipped: test/crew-sandbox-escape.test.ts: <reason>.
  • docs/ops/RED-TEAM.md: a new section, "The crew sandbox, attempt by attempt", lists every read and write attempt with its result and the test that holds it. The findings row and "Not done here" now point to it; the live run in the pod stays open as #10450.

Left out:

  • Egress to a public host by name. The check host may have no internet, so that test would pass whether or not the sandbox holds. The localhost case covers a name that is off the allowlist.
  • HTTPS CONNECT tunnels through the proxy.
  • The keep_plan updates the issue asked for: that tool wasn't available in this run.

To try it, on a host that can create user namespaces: bun test test/crew-sandbox-escape.test.ts.

🤖 Generated with Claude Code

commented

Write and egress escape attempts against a crew run's real sandbox are now tests in test/crew-sandbox-escape.test.ts, beside the read attempts from #10585. Each one fails if the attempt works. They have never run anywhere yet: the forge's check is the first real run.

Fix for the first check's failure. The check named the control test but not which of its two assertions failed, so the cause below is a likely one, not a confirmed one. The probe asked the proxy for the allowed forge only after the proxy had refused two off-list requests, and Bun may have reused that refused connection.

  • The forge request now runs before the off-list ones.
  • Every probe fetch sets keepalive: false.
  • The control is split into "control: the shell writes its own worktree" and "control: the shell reaches the forge's host:port through the proxy", so a failure names which half broke.
  • The probe now reports the error from its own write, and from each refused fetch, in its output.

What the tests try:

  • Writes: into the data dir and into another crew's dir, each four ways: by its path, through /proc/self/root, /proc/1/root, and /proc/<pid>/root of a process outside the sandbox. Each result is checked from outside the sandbox (the file must not exist), not from what the probe reports.
  • Egress: a server outside the sandbox, on a port that is not on the allowlist, tried as 127.0.0.1:<port> and as localhost:<port>. Each is tried directly and through the sandbox's HTTP_PROXY.
  • Controls: the shell must write into its own worktree, and must reach the allowed forge host:port through the proxy. These stop a probe that never ran, or a proxy that refuses everything, from passing as "all refused".
  • Skips: where no sandbox can be made, the whole file is skipped and the console prints skipped: test/crew-sandbox-escape.test.ts: <reason>, as in the read tests.

docs/ops/RED-TEAM.md gets a section, "The crew sandbox, attempt by attempt": one row per read or write attempt, with its result and the test that holds it. The findings table and "Not done here" now point to it.

Left out:

  • Egress to a public host by name: on a check host without internet that test would pass whether or not the sandbox holds.
  • HTTPS CONNECT tunnels through the proxy.
  • The plan updates on the issue: the keep_plan tool was not available in this run.

Checks run here: bun x tsc --noEmit and bun scripts/gate.ts pass. The test file only skips here (27 skipped), because this sandbox refuses user namespaces. To try it on a host that can create them: bun test test/crew-sandbox-escape.test.ts.

🤖 Generated with Claude Code

commented

I'll wait for the background poll to report.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs