Expand description
Inventory-based sandbox backend registry + fail-closed selection (#507).
This is the spine of the unified sandbox taxonomy: one SandboxBackend
seam, one selection model shared by every call site (no per-site ad-hoc
match with a silent _ => nspawn catch-all).
Backends are not a hardcoded enum. Each concrete backend self-registers a
BackendRegistration via inventory::submit! next to its implementation,
feature-gated by the #[cfg] that compiles that backend in (#518). The
registry is therefore exactly the set of backends built into this binary:
nspawn— registered only under thenspawnfeature (systemd-nspawn lightweight container).kata— registered only under thekatafeature (full VM isolation;kata-vmis a backward-compat alias forkata).oci— registered only under theocifeature (rootless OCI/podman container, #346).wasm— registered only under thewasmfeature (in-process WebAssembly, explicit-name-only).cri— registered only under thecrifeature (#510: a gRPC client of an external, already-running CRI runtime service — containerd’s CRI plugin, or CRI-O — not an embedded runtime). Explicit-name-only, likewasm: driving an external runtime is an auth-surface decision"auto"must never reach for on its own.
YAGNI: still-speculative tiers are intentionally not registered. They
gain a submit! when their phase actually builds them; until then they
simply do not exist as selectable names (an explicit request errors).
Selection is config-driven via worker.backend (a string: a registered
backend name, or "auto"):
"auto"→ among registrations that areauto_selectable, pick the highest-priorityone whoseis_availableprobe passes. The choice is logged. If none qualifies, error — never run a workload without isolation, and never auto-pick a backend that opted out of auto-selection (a silent isolation downgrade; see the in-processwasmtier, #547 ZSP).- a concrete name → that registration, iff it is registered and its
prerequisites are present. Otherwise error. We never substitute a different
(weaker) backend (the #486 fail-open bug). An explicit name resolves
regardless of
auto_selectable, so an auto-excluded backend (e.g.wasm) is still reachable when deliberately requested by name.
The cardinal rule is fail-closed: an unavailable or unknown backend returns an error, never a silent downgrade to weaker isolation.
Structs§
- Backend
Candidate - A cloneable projection of a
BackendRegistrationfor the substrate’s generic pipeline (SelectionReport<C>requiresC: Clone; a registration holdsfnpointers and is not cloneable). Carries exactly what selection filtering, ranking, and the explain trace need. - Backend
Ctx - Per-call construction context threaded to a backend’s
constructfn. - Backend
Registration - A compile-time sandbox-backend registration, collected via
inventory.
Functions§
- backend_
injects_ 9p_ socket - Does the registered backend named
backend_typeadvertise 9P socket injection? Returnsfalsefor an unknown/unregistered name. - explain_
selection - Explain what
"auto"selection would decide over the compiled-in registry, as the sharedSelectionReport. The winning candidate is the highest- priority backend that is both auto-eligible and available; every other candidate carries theRejectionReasonthat excluded it. - require_
9p_ socket_ capability - Fail-closed guard used at the workload seam: error unless
backend_typeadvertises 9P socket injection (#506). - require_
fuse_ mount_ capability - Fail-closed gate for Model B (#715): assert
backend_typeadvertises themounts_fuse_vfscapability before a caller FUSE-mounts the composed tenant VFS as that backend’s root. - resolve_
backend - Resolve
worker.backendto a constructedSandboxBackend, fail-closed. - resolve_
backend_ 9p_ capable - Resolve
worker.backendto aSandboxBackendthat is guaranteed capable of 9P socket injection (#506), fail-closed.