Description
Parent
What to build
Every grant worker in today's deployments gets the base layers that ADR 0001 defines. The Gateway library gains a worker sandbox module with one operation: confine the calling process as a grant worker. It reports the layers it applied, or fails naming the layer that failed. The grant worker calls it as the first thing it does, before it reads its control socket. Under the namespace sandbox, that happens inside bubblewrap, which is still launched as today.
The base layers, in order:
- Non-dumpable.
- Landlock: every access right the kernel's ABI knows, with no rules granted. No Landlock is reported as unavailable, not as an error.
no_new_privsand the seccomp allow-list. The allow-list permits only what a confined grant worker needs: receiving descriptors, its streams, threads, memory, randomness, clocks and exit. It checks the architecture and, on x86-64, rejects x32. Signals are allowed only to the grant worker's own process. Anything else kills the process.
The startup probe's worker confines itself and reports its layers over the control socket, and the supervisor logs the sandbox and each layer. A grant worker that dies by SIGSYS is logged as killed by the worker sandbox's filter and fenced through the existing worker-failure path, so its grant needs fresh approval.
ADR 0001 and the first GLOSSARY.md (on branch docs/18-worker-sandbox) land with this ticket. Use their terms: grant worker, worker sandbox, namespace sandbox, filter sandbox.
Acceptance criteria
- The worker sandbox module is public in the Gateway library, with one confine operation that reports the applied layers (allow-list, Landlock ABI or unavailable, non-dumpable) or names the layer that failed
- Every grant worker, including the startup probe's worker, confines itself before reading any input
- Startup logs the worker sandbox and each layer applied, including the Landlock ABI version or "Landlock unavailable"
- A new Rust integration test confines two concurrent stand-in grant workers through the module, hands each a stream by
SCM_RIGHTS, and proves for each: the stream arrives and threads work; opening a file, reading the supervisor's environment, reading the supervisor's memory, reading the other worker's memory, TCP connect, UDP send, running a program and signalling another process are all refused; signalling itself works; a forbidden system call kills it withSIGSYS - The allow-list rejects a foreign architecture, and the x32 range on x86-64
- A grant worker killed by
SIGSYSis logged as killed by the filter, and its grant is fenced and needs fresh approval - The existing runtime test passes unchanged under the namespace sandbox in CI (sidecar and shared mode, concurrent users, cutoff, revocation)
- ADR 0001 and
GLOSSARY.mdare merged with this change - CI runs the Gateway crate's tests, the worker sandbox containment test among them, and the runtime test on arm64 Linux
- A host that refuses Landlock's version query with
EPERM, as a container profile older than Landlock does, is reported as Landlock unavailable, and the grant worker is still confined
Decided in: #21 (spec); ADR 0001; the probe and research on prototype/18-isolation-probe
Live step at merge: none
Activity
Grant workers confine themselves with the worker sandbox's base layers (
Test the confine-before-input order, non-dumpable memory and fresh ap…
Serve threads without clone3, narrow fcntl, and probe what a connecti…
Run the Gateway's tests and the runtime test on arm64 Linux in CI (#22)
Keep ADRs out of the handbook build, like the specs and agent docs (#22)
Trim the arm64 job to what the runtime test needs (#22)
A host that denies Landlock with EPERM runs without it (#22)