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

Crew sandbox: escape attempts under procMount Unmasked, each a test #10460

Parked opened this
Closed without merging

I added the escape tests, but none of them has run: this sandbox refuses user namespaces, so the new file skips here (8 skipped, 0 failed). tsc and the gate came back clean. I did not run the existing sandbox suites, and I made no keepplan calls (the tool wasn't available to me).

Notes

stopped parked by the crew deploy 44efd36

opened this

I added the escape tests, but none of them has run: this sandbox refuses user namespaces, so the new file skips here (8 skipped, 0 failed). tsc and the gate came back clean. I did not run the existing sandbox suites, and I made no keep_plan calls (the tool wasn't available to me).

The forge's check, on a host that allows bwrap, will be the first real run. If an attempt works there, its test goes red and that row in docs/ops/RED-TEAM.md becomes a finding. Until then, no door in the new table is claimed held.

What changed

  • test/crew-sandbox-escape.test.ts (new): it starts a real bwrap shell, through srt, under the settings the crew hands Claude Code. Each attempt below has its own test.

- Reading outside the worktree: a denied data file and another crew's file, directly and through /proc/self/root, /proc/1/root and /proc/<pid>/root. - Process environments: every /proc/<pid>/environ, including /proc/1/environ, for a secret held by a process outside the sandbox. - Writing outside the worktree: the data dir, another crew's dir, beside the worktree, the home dir and /etc, directly and through /proc/*/root. - Network: a loopback port the policy doesn't name, direct and through the proxy, plus an internet host and a TEST-NET address. - Control check: a worktree write must succeed, so a probe that failed to run can't pass as "all refused".

  • docs/ops/RED-TEAM.md: a new section lists each attempt, what its test asserts, and the result "not yet observed". I also pointed the sandbox row at the real tests.

Left out

  • The live run inside the pod is still open.
  • /etc and the home directory are only writable in the test if the runner can write there. If it can't, those two writes fail for a boring reason and say nothing about the sandbox.

Try it

  • Run bun test test/crew-sandbox-escape.test.ts on a host where bwrap --unshare-user works. It needs rg and bun install. Without them it skips.

Closes #10450

3 earlier comments
commented

I added the escape tests, but none of them has run: this sandbox refuses user namespaces, so the new file skips here (8 skipped, 0 failed). tsc and the gate came back clean. I did not run the existing sandbox suites, and I made no keep_plan calls (the tool wasn't available to me).

The forge's check, on a host that allows bwrap, will be the first real run. If an attempt works there, its test goes red and that row in docs/ops/RED-TEAM.md becomes a finding. Until then, no door in the new table is claimed held.

What changed

  • test/crew-sandbox-escape.test.ts (new): it starts a real bwrap shell, through srt, under the settings the crew hands Claude Code. Each attempt below has its own test.

- Reading outside the worktree: a denied data file and another crew's file, directly and through /proc/self/root, /proc/1/root and /proc/<pid>/root. - Process environments: every /proc/<pid>/environ, including /proc/1/environ, for a secret held by a process outside the sandbox. - Writing outside the worktree: the data dir, another crew's dir, beside the worktree, the home dir and /etc, directly and through /proc/*/root. - Network: a loopback port the policy doesn't name, direct and through the proxy, plus an internet host and a TEST-NET address. - Control check: a worktree write must succeed, so a probe that failed to run can't pass as "all refused".

  • docs/ops/RED-TEAM.md: a new section lists each attempt, what its test asserts, and the result "not yet observed". I also pointed the sandbox row at the real tests.

Left out

  • The live run inside the pod is still open.
  • /etc and the home directory are only writable in the test if the runner can write there. If it can't, those two writes fail for a boring reason and say nothing about the sandbox.

Try it

  • Run bun test test/crew-sandbox-escape.test.ts on a host where bwrap --unshare-user works. It needs rg and bun install. Without them it skips.
commented

The red check was not caused by my change. src/kernel/why_now.ts was an orphan on main: commit 54dacba00 retired the "why now" direction, and nothing under src/ imports the module any more. Only test/why-now.test.ts did. That is what failed "every module under src/ is imported by another, or allowed".

I merged main into the branch and removed the module and its test. test/unreached.test.ts and tsc --noEmit now pass locally. I did not run the full check.

The second failure is probably load-related, not a real one. Shard 16 was killed after 10 s on test/thread-limits-words.test.ts. That file passes locally, and its sentences and form imports have nothing to do with this change or the orphan. I did not try to reproduce the timeout. Check whether it shows up again on this push.

My own test, test/crew-sandbox-escape.test.ts, skips here because the sandbox refuses user namespaces. It runs for real in the forge's check, and the shard 14 log showed no failure from it.

The only thing I added this round is the removal commit.

commented

I changed no code in this round. The failing tests look like load flakes, so I merged the latest main into the branch and pushed to get a fresh check.

  • Local reruns: the growth-measure test (in test/highlight.test.ts), the System telemetry test (in test/tui-system.test.ts) and test/resilience.test.ts all pass here.
  • Why I think they flaked: none of these tests touch the files this pull changes. The growth-measure test is timing-based, and it ran in the 103-shard check, where one shard was also killed for running over 75 s.
  • After the merge: bun scripts/gate.ts and bun x tsc --noEmit ran with no output, so I take them as clean. test/crew-sandbox-escape.test.ts shows 0 pass and 8 skipped, which I believe is the unix-socket skip in this sandbox, so it did not run here.
  • Not run: the full suite, which the forge runs.

If the new check fails on those same tests again, that points to a real cause I missed, and I'll look again with that log.

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