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
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:
1 parent
11d4a3f5d7
commit
ff3bfd03a1
13 files changed
+587
No files matched your search
@@ -401,6 +401,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
|
||||
## Remaining future scope
|
||||
|
||||
- **Wave 148 (Hermetic sandboxing, F1)**: `Sandbox::sandbox_supported()` probes unprivileged user namespaces; `vbs build|test|run --sandbox=off|warn|strict` (or `VBS_SANDBOX`) wraps every action in the hidden `vbs __sandbox-exec` mode, which unshares user/mount/network namespaces, maps the caller to root, binds the project read-only, the build root (snapshots included) read-write, and `/usr`, `/lib`, `/bin`, `/etc` and the Nix store read-only before `pivot_root` and exec. `/proc`, `/sys` and `/dev` are bound read-write (their mounts cannot be remounted read-only from a user namespace), `/tmp` is an empty directory, and system read-only remounts that the kernel refuses degrade to writable binds (the project itself is required to be read-only). `vbs doctor` reports availability, CI runs a strict smoke build when the runner allows user namespaces, and `FullV1Tests.sandbox_strict_allows_project_builds_and_hides_outside_files` proves a strict build succeeds while an action that reads an outside file fails.
|
||||
|
||||
- **Wave 147 (Lifecycle CLI and native compiler caching, G1/G7 start)**:
|
||||
- `vbs run` builds and executes an executable target with program arguments and passes the exit code through; it uses Void::Process with inherited stdio so interactive programs keep the terminal, and runs Windows targets under Wine.
|
||||
- `vbs metadata` emits a schema-versioned workspace document (roots, profile, compiler, targets with sources/includes/links/labels/install rules, dependencies, lockfile revision) built with `Void::Json::Strict` instead of hand-written JSON.
|
||||
@@ -413,6 +415,7 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
- `vbs new` is a Cargo-style alias of `init` with the same templates.
|
||||
- `--bep FILE` on `build`/`test`/`run` writes a newline-delimited JSON Build Event Protocol stream (build/profile started, action started/finished, test finished with exit code, build finished), serialized with `Void::Json::Strict`.
|
||||
- **Native compiler caching**: `--native-cache off|auto|ccache|sccache` (or `VBS_NATIVE_CACHE`) prepends ccache/sccache to compile actions only; the wrapper and real compiler are part of the action key, archives/links are untouched, and `vbs doctor` reports availability. Verified deterministically by `FullV1Tests.native_cache_wrapper_is_lowered_into_compile_commands` and end to end when the tool is installed (`native_cache_wraps_compile_actions`).
|
||||
- **Hermetic sandboxing**: `--sandbox=off|warn|strict` (or `VBS_SANDBOX`) runs actions through `vbs __sandbox-exec`, which unshares user/mount/network namespaces and pivots into a root containing only the read-only project, the writable build root and read-only system/toolchain roots; `vbs doctor` reports support and the strict lane degrades to a warning only when the host lacks user namespaces.
|
||||
|
||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||
|
||||
|
||||
@@ -147,4 +147,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 145 (Coverage reporting) | `vbs test --coverage DIR`; gcov JSON -> lcov + summary | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `include/Void/Build/Report/Coverage.hpp`, `src/Report/Coverage.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Wave 146 (CI hardening, explainability, shared caches, CLI surface, migration breadth) | CI image tool upgrades + coverage lane; test `--repeat/--retry/--shuffle/--stop-on-failure`; `vbs explain`; `--trace` Chrome traces; shared descriptor/probe caches; `vbs completions`/`vbs man`; `vbs migrate --from meson`; `vbs init --template`; `vbs presets --export`; MSI installer | COMPLETE & VERIFIED (GCC 16.2; new FullV1Tests cases for every feature pass, CLI contract suite passes; cold build 3897 -> 755 ms measured) | `src/Main.cpp`, `src/Execution/Scheduler.{hpp,cpp}`, `src/Cli/CommandModel.{hpp,cpp}`, `src/Config/{Frontend,Scaffold,CmakeImport}.cpp`, `src/Toolchain/Driver.cpp`, `include/Void/Build/Util/UserCache.hpp`, `.gitea/workflows/ci.yml`, [Void/CI-Images](https://git.faumaray.com/Void/CI-Images), `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Wave 147 (Lifecycle CLI + native caching + BEP) | `vbs run` (Void::Process inherited stdio, exit-code passthrough, Wine), `vbs metadata` (StrictJson schema v1), `vbs why`, `vbs tree`, `vbs fmt`/`vbs lint`, `vbs install-binary`, `vbs add`/`vbs remove` (Semver-validated manifest editing + lock refresh), `vbs new`, `--frozen`, `--bep` event stream, `--native-cache off/auto/ccache/sccache` with doctor reporting | COMPLETE & VERIFIED for the implemented commands (GCC 16.2; lifecycle, tree, fmt, BEP and native-cache tests pass; CLI contracts pass) | `src/Main.cpp`, `src/Toolchain/Driver.{hpp,cpp}`, `src/Package/Manifest.{hpp,cpp}`, `include/Void/Build/Package/Manifest.hpp`, `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Wave 148 (Hermetic sandboxing) | `Sandbox::sandbox_supported`, `Sandbox::apply_sandbox`, hidden `vbs __sandbox-exec` wrapper, `--sandbox=off|warn|strict`/`VBS_SANDBOX`, project read-only + build root writable + system/toolchain roots read-only, doctor reporting, CI strict smoke step | COMPLETE & VERIFIED (GCC 16.2; `sandbox_strict_allows_project_builds_and_hides_outside_files` passes: strict build succeeds and an action reading an outside file fails; CLI contracts pass) | `include/Void/Build/Sandbox/Sandbox.hpp`, `src/Sandbox/Linux/NamespaceSandbox.cpp`, `include/Void/Build/Execution/Scheduler.hpp`, `src/Execution/Scheduler.cpp`, `src/Main.cpp`, `.gitea/workflows/ci.yml`, `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Future (Plans 23–24) | Gap closure and superiority tracks | PLANNED (see the plans for per-track acceptance gates) | [23-remaining-upgrade-plan.md](../roadmap/23-remaining-upgrade-plan.md), [24-superiority-tracks.md](../roadmap/24-superiority-tracks.md) |
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user