pub struct SandboxSpec {
pub read_only_paths: Vec<PathBuf>,
pub writable_paths: Vec<PathBuf>,
pub network: NetworkPolicy,
pub env: Vec<(String, String)>,
pub timeout: Option<Duration>,
}Expand description
What a sandboxed command is permitted to touch.
Construct with SandboxSpec::deny_all, then relax. Validation lives in
SandboxSpec::validate so an impossible policy is rejected before any
process is spawned.
Fields§
§read_only_paths: Vec<PathBuf>Paths mounted read-only inside the sandbox.
writable_paths: Vec<PathBuf>Paths the command may write.
network: NetworkPolicyNetwork reachability.
env: Vec<(String, String)>Environment handed to the command, applied after the backend default.
timeout: Option<Duration>Wall-clock limit; None means the backend default applies.
Implementations§
Source§impl SandboxSpec
impl SandboxSpec
Sourcepub fn with_read_only(self, path: impl Into<PathBuf>) -> Self
pub fn with_read_only(self, path: impl Into<PathBuf>) -> Self
Grant a read-only path.
Sourcepub fn with_writable(self, path: impl Into<PathBuf>) -> Self
pub fn with_writable(self, path: impl Into<PathBuf>) -> Self
Grant a writable path.
Sourcepub fn with_network(self, network: NetworkPolicy) -> Self
pub fn with_network(self, network: NetworkPolicy) -> Self
Set network reachability.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set a wall-clock limit.
Trait Implementations§
Source§impl Clone for SandboxSpec
impl Clone for SandboxSpec
Source§impl Debug for SandboxSpec
impl Debug for SandboxSpec
Source§impl Default for SandboxSpec
impl Default for SandboxSpec
Source§impl<'de> Deserialize<'de> for SandboxSpec
impl<'de> Deserialize<'de> for SandboxSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SandboxSpec
Source§impl PartialEq for SandboxSpec
impl PartialEq for SandboxSpec
Source§impl Serialize for SandboxSpec
impl Serialize for SandboxSpec
impl StructuralPartialEq for SandboxSpec
Auto Trait Implementations§
impl Freeze for SandboxSpec
impl RefUnwindSafe for SandboxSpec
impl Send for SandboxSpec
impl Sync for SandboxSpec
impl Unpin for SandboxSpec
impl UnsafeUnpin for SandboxSpec
impl UnwindSafe for SandboxSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.