feat(sandbox): implement probe-gated Linux strict isolation (ADR-0021)

Strict mode now re-executes the CLI inside a Bubblewrap supervisor with
user/mount/PID/net/UTS/IPC namespaces, no-new-privs, all capabilities dropped,
a read-only /project, private /proc and /dev, rlimits, output capture and
wall-clock process-group cleanup. The child verifies PID 1, NoNewPrivs, empty
CapEff, an unshared uid map and loopback-only networking before project code.

- PlatformCapabilities::detect runs a real bwrap probe; no probe, no strict
- strict L1 supports pure Marqdo + Math; Foreign/ABI/worker/kernel/grants/trace
  are rejected with exit 2 before sandboxing
- forged MARQDO_STRICT_ACTIVE is rejected; missing bwrap fails closed
- add adversarial helper, 7-test escape/resource matrix, seeded security lane
  script and self-hosted security workflow
- executed G-C lane as uid 1000 in a disposable Ubuntu 26.04 VM: 7/7 PASS
  plus positive CLI and refusal matrix; evidence in docs/evidence
- ADR-0021, spec/security.md, STATUS/COMPATIBILITY/README/CHANGELOG updated;
  ADR-0019 remains for non-Linux/fail-closed rules
This commit is contained in:
cflmy committed 2026-11-20 15:01:49 +08:00
1 parent 9b001a33a5
commit b6fc18233d
22 files changed
+1886 -132

No files matched your search

+8 -6
View File
@@ -34,7 +34,7 @@ portable/tested locally but the native platform lane has not run here;
| Worker ABI + `fs.read` bridge | PASS (Unix) | UNVERIFIED | UNSUPPORTED (tests are Unix-gated) |
| Foreign Python/Node | PASS (system `python3`/`node`) | UNVERIFIED | UNVERIFIED |
| Foreign pinned environment binding | PASS | UNVERIFIED | UNVERIFIED |
| `strict` OS isolation | **FAIL-CLOSED / G-C NOT PASSED** | FAIL-CLOSED | FAIL-CLOSED |
| `strict` OS isolation | PASS when runtime probe passes (VM-verified); no CI URL yet | FAIL-CLOSED | FAIL-CLOSED |
The Ubuntu column is from this development host (Ubuntu 26.04 container). It is
**not** a GitHub Actions result: this checkout has no GitHub remote or CI
@@ -46,14 +46,16 @@ reproduce the Windows checkout byte behavior.
- Rust 1.82+ (verified with 1.100.0).
- Linux/macOS: a C compiler for Native ABI fixtures; Python/Node only for
Foreign kernels.
- `strict` additionally requires a kernel/environment that permits user,
mount, PID and network namespaces, plus delegated cgroups. The current
container does not, so strict is refused. See
[`docs/security-gate.md`](docs/security-gate.md).
- `strict` additionally requires Bubblewrap and a kernel/environment that
permits user, mount, PID and network namespaces. It is enabled only when the
runtime probe passes; the current development container fails that probe, so
strict is refused there. See [`docs/security-gate.md`](docs/security-gate.md)
and ADR-0021.
## Explicitly unsupported in this candidate
- OS-level strict isolation on any platform (G-C not passed).
- OS-level strict isolation on macOS/Windows (Linux only, probe-gated).
- Strict L2: Worker/Foreign execution inside strict (refused in L1).
- Windows Native/Worker ABI runtime support.
- Automatic uv/npm/venv provisioning; only an explicitly provisioned, pinned
directory is verified (and must contain a regular-file executable).