pub struct SandboxOptions {
pub read_only_paths: Vec<PathBuf>,
pub read_write_paths: Vec<PathBuf>,
pub home: Option<PathBuf>,
pub cargo_home: Option<PathBuf>,
pub rustup_home: Option<PathBuf>,
pub cargo_bin: Option<PathBuf>,
}Expand description
Fields§
§read_only_paths: Vec<PathBuf>Extra host paths bound read-only (from allowed_paths).
read_write_paths: Vec<PathBuf>Extra host paths bound read-write (from allowed_paths).
home: Option<PathBuf>Host $HOME, bound read-only so paths nested under it stay reachable.
cargo_home: Option<PathBuf>Writable directory exposed as $CARGO_HOME. A read-only toolchain
cannot update cargo’s package-cache lock, so builds need somewhere
writable; pointing this at a cache directory under the data dir keeps
~/.cargo untouched at the cost of an empty registry.
rustup_home: Option<PathBuf>Host $RUSTUP_HOME, bound read-only so a rustup proxy resolves a
toolchain.
cargo_bin: Option<PathBuf>Host $CARGO_HOME/bin, bound read-only so cargo/rustc are on
PATH. Separate from Self::cargo_home because that one must be
writable.
Implementations§
Source§impl SandboxOptions
impl SandboxOptions
Sourcepub fn home(&self) -> Option<&Path>
pub fn home(&self) -> Option<&Path>
The home directory, exposed to sandboxed commands only as $HOME.
Never bound: bwrap creates mountpoint parents on demand, so a nested
read-only bind (say ~/.cargo/bin) works without exposing the rest of
home — and binding home would defeat the point of the tmpfs root by
making every personal directory under it visible.