feat(broker): let a confined worker start programs from /nix/store
Problem
RFC 0008's open question: is the confined worker's default path list right? It allowed read, list, and execute beneath /usr, /lib, /lib64, /bin, and /sbin, plus a few single files, and had only been measured on CI's Ubuntu. This is the sixth item of M10 in the roadmap: run tests/broker_confined.rs on Debian, Fedora, Arch, Alpine (musl), and NixOS, on the runner's kernel.
Root cause
On Nix and NixOS, every program, its dynamic loader, and its libraries live in /nix/store, and /bin/sh links there. That directory was in no default rule, so exec of any program failed with EACCES and a confined worker could not start at all. The other four systems keep their loader and libraries beneath the default directories.
Change
-
A
distrosjob inci.yml, with one container per system, each pinned by digest:System Image Toolchain Debian 13 debian:13-slimDebian's rustc1.85.1Fedora 45 fedora:45Fedora's rust1.99.1Arch archlinux:base-20261108.0.623074Arch's rust, current when the job runs (1.99.1 here)Alpine 3.24 alpine:3.24.4Alpine's rust1.96.1, which links against musl dynamicallyNix nixos/nix:2.35.6nixpkgs nixos-26.05atac588ef(rustc1.95.0).github/distros/setup.shruns as root and installs the system's own toolchain. The tests then link the way its programs do: against its libc and through its loader. A rustup toolchain would hide that. Its musl target links statically, and on Nix it would use/lib64..github/distros/test.shruns as the runner's user. It prints the loader and libraries the test executable and/bin/shneed, then runscargo test --locked --test broker_confinedwith no--direct.- The
workflowsjob shellchecks both scripts.
-
/nix/storeis a default runtime directory for a confined worker, with read, list, and execute, and is skipped where it does not exist. A grant that overlaps it is now refused, as one that overlaps/usris. The maintainer chose this over documenting--direct /nix/store:rlx.
Safety and compatibility
- The worker can now read everything in
/nix/store. The store holds build outputs, which every local user can already read, and opens there are not audited, as for/usr. A secret someone put in the store was already world-readable. - A grant inside
/nix/storethat givesREADorLISTnow fails before the worker starts, where the store exists. The worker could read it directly. - Where
/nix/storedoes not exist, nothing changes.
Verification
CI on 112acfe, before the change, with no --direct:
| System | Dynamic loader | /bin/sh | broker_confined |
|---|---|---|---|
| Debian 13 | /lib64/ld-linux-x86-64.so.2 | dash | 47 passed, 2 ignored |
| Fedora 45 | /lib64/ld-linux-x86-64.so.2 | bash | 47 passed, 2 ignored |
| Arch | /lib64/ld-linux-x86-64.so.2 | bash | 47 passed, 2 ignored |
| Alpine 3.24 (musl) | /lib/ld-musl-x86_64.so.1 | busybox | 47 passed, 2 ignored |
| Nix | /nix/store/…-glibc-2.42-103/lib/ld-linux-x86-64.so.2 | bash in /nix/store | 18 failed with "starting … failed: Permission denied", 29 passed |
CI on 5eb744b, with /nix/store added: all five passed 47, with 2 ignored, and all 19 checks passed. The 2 ignored tests need a kernel without Landlock or below ABI v3, which the kernels job boots.
After merging main (#78, #84), all 20 checks passed on 74feb18, all five distros included.
The first run failed on Nix before any test, because test.sh used sed, which the image lacks; the toolchain now includes it.
Locally, on macOS 26.2 with Rust 1.99.1:
cargo fmt --all --check,cargo clippy --all-targets --locked -- -D warnings, andcargo clippy --locked --target x86_64-unknown-linux-gnu -p fsgate --all-targets -- -D warnings(a type-check, not a run): clean.cargo test --locked: 121 passed.actionlint1.7.12 (with shellcheck 0.11.0),zizmor1.32.0 offline, andshellcheckon both scripts: no findings.
Not verified:
- A full NixOS system. The
nixos/niximage has NixOS's store layout but not its/run/current-systemor its services. - Guix, whose
/gnu/storehas the same shape and is not added. - arm64 containers, and kernels other than the runner's 7.0.
- Programs that need more than a loader and libraries to start, such as locale or timezone data under
/usr/shareor/etc. The tests start the test executable and/bin/sh. - A pinned Arch toolchain. Arch packages are rolling, so the job installs whatever is current.
- Docker's own confinement. Docker's default seccomp and AppArmor profiles stayed on and allowed Landlock, but the job does not test running without them.
Documentation and release
- RFC 0008 lists
/nix/store, answers its open question with the table above, and records the decision. - The README's confinement paragraph and status, the threat model's row for runtime paths, and the roadmap list it too. The roadmap ticks M10's sixth item.
CHANGELOG.mdhas an Unreleased entry under Changed.