pub struct IsolationPolicy {
pub ro_binds: Vec<(PathBuf, PathBuf)>,
pub work_host: Option<PathBuf>,
pub network: bool,
pub env_allowlist: Vec<String>,
}Expand description
What the sandbox does and doesn’t let a stage reach.
Derived from a stage’s EffectSet via
IsolationPolicy::from_effects. Callers rarely construct this
manually; it’s shaped so the stage executor can translate it into
backend-specific flags (bwrap args in Phase 1, unshare+landlock+seccomp
in Phase 2).
Fields§
§ro_binds: Vec<(PathBuf, PathBuf)>Read-only bind mounts: (host_path, sandbox_path). Always
includes /nix/store so Nix-pinned runtimes resolve inside
the sandbox.
work_host: Option<PathBuf>Scratch directory strategy for /work inside the sandbox.
None(recommended, and the default fromSelf::from_effects) →bwrapcreates/workas a sandbox-private tmpfs via--dir /work. No host-side path exists; cleanup happens automatically when the sandbox exits; a malicious host user can’t race to write predicatable filenames into the work dir before the stage runs.Some(host)→--bind <host> /work. Host dir must exist and be writable by the sandbox’s effective UID (65534 by default). Only for callers that need to inspect the work dir after execution — e.g., an integration test.
network: boolInherit the host’s network namespace (true) or unshare into
a fresh empty one (false). Only true when the stage has
Effect::Network.
env_allowlist: Vec<String>Environment variables to pass through to the sandboxed process. Everything else in the parent environment is cleared.
Implementations§
Source§impl IsolationPolicy
impl IsolationPolicy
Sourcepub fn from_effects(effects: &EffectSet) -> Self
pub fn from_effects(effects: &EffectSet) -> Self
Build the policy for a stage with the given effects.
Defaults to a sandbox-private /work (tmpfs, no host-side
state). Callers that need a host-visible work dir can swap in
Self::with_work_host.
Sourcepub fn with_work_host(self, host: PathBuf) -> Self
pub fn with_work_host(self, host: PathBuf) -> Self
Override the sandbox’s /work to bind a caller-provided host
directory. The directory must already exist and be writable by
the sandbox effective UID (65534). Consumers mostly leave the
default (tmpfs).
Trait Implementations§
Source§impl Clone for IsolationPolicy
impl Clone for IsolationPolicy
Source§fn clone(&self) -> IsolationPolicy
fn clone(&self) -> IsolationPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more