Sandbox
Typed declarative sandbox profile. The profile is the single source of truth; four enforcement backends — bubblewrap, Landlock, seccomp BPF, and systemd hardening — consume the same declaration and produce backend-specific configuration.
Three-layer defense:
1. bwrap: mount namespace, PID namespace, seccomp stage-1.
2. Landlock: path-based filesystem access (applied from inside
the process post-init).
3. seccomp stage-2: self-applied filter blocking execve
post-init when the profile is sealed.
Smart constructor
sandbox.define { readOnlyPaths?; readWritePaths?; tmpfs?; listenTcp?; connectTcp?; display?; stdio?; unixSockets?; allowExecve?; allowFork?; lifecycle?; daemonMode?; dns?; sourceAccess?; sourceWritePaths?; coordinationWritePaths?; storeAccess?; }proxies tomb.operations.sandboxProfile(eager structural validation againstSandboxProfile.T).Built-in profiles as typed
SandboxProfilevalues:profiles.sealed(the empty default),profiles.effectful(sealed + execve + fork). Anything host- or workload-specific composes downstream.Eliminators:
toBwrap : SandboxProfile → [String]— bubblewrap argument list. DNS handling routes throughprofile.dnswhen present.toLandlock : SandboxProfile → LandlockProfile— path-list + port-list view.toSeccomp : SandboxProfile → SeccompStage → Thunk Derivation— BPF filter; stageBwrapincludesprocessExec, stageSelfrespectsallowExecve.toSystemd : SandboxProfile → SystemdHardening— directives suitable forsystemd.services.<name>.serviceConfig.Closed-sum re-exports:
SeccompStage = Bwrap | Self,Lifecycle = LongRunning | OneShot.Combinators in
sandbox.combinators:compose, base profiles (sealed/effectful), network (listen/connectTo), filesystem (readonly/readwrite), execution (allowExec/allowFork), lifecycle (daemon), and adefermeta-combinator for two-pass composition. Each carries{ sig; doc; impl }metadata.Seccomp compiler:
syscallSetsexposes 12 generic syscall categories.mkFilter/mkAllowlist/flattenPolicycompose them into BPF filters via the bundledgen-seccomp-bpftool. The compiler is a standalone C program (single source file) that reads a newline-separated allowlist and emits a BPF blob.