Expand description
Default-deny worker-process sandboxing for OpenVMM and OpenHCL.
A Profile describes filesystem grants, network scope, and optional
syscall denials. prepare computes launch requirements; apply
establishes worker-side confinement. Selecting and enabling a policy is the
consumer’s responsibility, not an automatic consequence of using this crate.
§Integration status and limits
PAL supports prepared Linux sandbox launches, and Mesh accepts optional
sandbox profiles. Existing OpenVMM workers are not yet enabled: they still
use ordinary launches and do not call the required early worker-side
apply. Tracing and profiling are separate changes.
On Linux, self-mapped workers retain their host UID/GID and PID visibility. Cross-process signaling is not yet restricted, so this is not a complete isolation boundary against other processes running under the same host UID.
§Three stages
Sandboxing happens in named, ordered stages:
prepare— runs in the control process, just before it spawns the worker. It returns a plain-dataSandboxProcessConfigdescribing the child’s launch environment (which Linux namespaces to create, which handles stay inheritable, whether to self-map IDs, and — on Windows — the LPAC construction data). The caller passes that prepared configuration intact to the platform process builder, which performs the spawn. This crate deliberately depends on neithermeshnorpal: it decides what the launch environment must be; PAL decides how to apply it.apply— the first statement of the worker’smain(). On Linux the worker configures the namespaces it was cloned into, then appliespivot_root, capability drop, hardening,no_new_privs, and optional seccomp. It must run before any thread is spawned, any async runtime starts, or any untrusted input is consumed.tighten— an optional, additive-only ratchet a worker calls once it has finished initializing, to shed its init-only authority. It takesRestrictions, a type that can only ever narrow.
§Handle hygiene is the process builder’s job
There is no grant envelope and no descriptor sweep inside this crate.
prepare reports exactly which handles must remain inheritable;
the platform process builder keeps those and its configured standard I/O
inheritable while closing or marking every other descriptor before the
child is reached.
§Platform support
The Linux backend is implemented. On Windows the launch-time LPAC data is
produced by prepare, but the post-launch apply/tighten half is not yet
implemented and returns Error::UnsupportedPlatform rather than a silent
no-op (fail-loud). Other platforms are unsupported.
Linux namespace creation and UID/GID mapping must be permitted by host policy. Kernel support alone is not sufficient; this crate does not install AppArmor policy or change system security settings.
Modules§
- profiles
- Base and worker-specific sandbox profiles.
Structs§
- Builder
- Policy builder for filesystem grants, network scope, and syscall denials.
- Capability
- An opaque, named platform capability, constructed from crate-provided constants. The consumer never sees the underlying SID or grant.
- Denied
Syscall - One configured syscall denial.
- Identity
- Per-spawn identity for the worker.
- Linux
Preparation - Linux-specific launch requirements for a
SandboxProcessConfig. - Profile
- An opaque, immutable sandbox policy.
- RawHandle
- A child-visible, platform-native handle value: a target file-descriptor
number on Unix, or an inherited
HANDLEvalue on Windows. - Restrictions
- A narrow, additive-only ratchet consumed by
tighten. - Restrictions
Builder - Narrowing-only ratchet builder. There is deliberately no “unfiltered” escape here — a ratchet only ever subtracts.
- Sandbox
Process Config - The result of
prepare: everything the platform process builder needs to apply before the spawn.
Enums§
- Enforcement
- Whether denying a syscall is required or workload-dependent.
- Error
- An error produced while preparing or applying a sandbox.
- Network
- Network reachability granted to the worker.
- Syscalls
- Syscall-filtering policy (Linux; opt-in per worker class).
Constants§
- DISABLE_
ENV - Environment variable that disables the sandbox — debug builds only.
- EXIT_
SANDBOX_ FAILED - Process exit code used when a required sandbox primitive fails to apply.
Functions§
- apply
- STAGE 2 — worker, the first statement of
main(). - nr_
for_ name - Resolve a syscall name — as written in a profile’s
Syscalls::Denylist — to its architecture-native syscall number. - platform_
syscall_ denylist - Iterate over the syscall denial policy for the current platform.
- prepare
- STAGE 1 — control process, immediately before the spawn.
- tighten
- STAGE 3 (optional) — worker, after its own initialization.