feat(sandbox): hermetic action sandboxing (F1)
VoidBuildSystem CI / 1 · Requirements (push) Successful in 10s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 3m20s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 3m27s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m28s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m8s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m5s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 23s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 21s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 5m27s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m17s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m0s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 7m41s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m44s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped

Adds Sandbox::sandbox_supported()/apply_sandbox() and a hidden
`vbs __sandbox-exec` wrapper used by the scheduler for every action:

- unshare(CLONE_NEWUSER|CLONE_NEWNS|CLONE_NEWNET), map the caller to
  root, make mounts private, bind the project read-only, the build root
  (including .vbs snapshots) read-write, system/toolchain roots
  (/usr, /lib, /bin, /etc, Nix store, sysroot) read-only, /proc, /sys
  and /dev writable, an empty /tmp, then pivot_root and exec.
- `--sandbox=off|warn|strict` (or VBS_SANDBOX) on build/test/run;
  strict fails explicitly when the host lacks unprivileged user
  namespaces, warn degrades to an unsandboxed run with a warning.
- vbs doctor reports sandbox availability; CI runs a strict smoke build
  when the runner allows user namespaces.

Implementation notes: the sandbox root is a bind mount (tmpfs inside a
user namespace returns EOVERFLOW on this kernel), read-only remounts
that the kernel refuses for inherited mounts degrade to writable binds,
and the project remount is required.

Verified: fullV1Tests.sandbox_strict_allows_project_builds_and_hides_
outside_files passes (strict build succeeds; an action reading an
outside file fails), vbs_core_tests 8/8, CLI contracts pass,
clang-format clean.
This commit is contained in:
faumaray committed 2026-12-06 19:45:07 +03:00
1 parent 11d4a3f5d7
commit ff3bfd03a1
13 files changed
+587

No files matched your search

+10
View File
@@ -80,6 +80,16 @@ JUnit, CDash, coverage), all nine installer formats, pkg-config, ASM/shader bund
### F1 — Hermetic sandboxing *(L)*
**Status: implemented (Wave 148).** `vbs build|test|run --sandbox=off|warn|strict` (or
`VBS_SANDBOX`) runs actions through the hidden `vbs __sandbox-exec` wrapper: user/mount/network
namespaces, caller mapped to root, project read-only, build root (snapshots included) writable,
system/toolchain roots read-only, `/tmp` empty, `pivot_root` before exec. `/proc`, `/sys` and
`/dev` are bound read-write because their mounts cannot be remounted read-only from a user
namespace; read-only remounts the kernel refuses degrade to writable binds, while the project
remount is required. `vbs doctor` reports availability and CI runs a strict smoke build when
the runner allows user namespaces. Verified by
`FullV1Tests.sandbox_strict_allows_project_builds_and_hides_outside_files`.
**Goal.** Make "actions see only their snapshot inputs" a guarantee, not a convention: an action
inherits a mount namespace in which the project snapshot tree is read-only, the profile build
directory is writable, the toolchain and system libraries are read-only, and nothing else of the
+4
View File
@@ -265,6 +265,10 @@ Fortran are cheap to add to images); each language's incremental model differs.
### G5 — Trust: enforced hermeticity, attestations, reproducibility, advisories *(L)*
**Status: partially implemented (Wave 148).** Done: the enforced hermetic sandbox (Plan 23 F1)
for compile/link/custom actions. Pending: SLSA/in-toto attestations, the sandboxed descriptor,
`vbs audit` advisories, dependency-confusion guards, policy-as-code (G11) and `verify-repro`.
**Beats:** all four. Cargo has `cargo-deny` externally; CMake/Meson/build2 have nothing built in.
Plan 23 already schedules the sandbox (F1) and reproducibility (F11); this track adds the