pub struct SandboxState {
pub fs: Vec<FsCapState>,
pub unix_sockets: Vec<UnixSocketCapState>,
pub net_blocked: bool,
pub resource_limits: Option<ResourceLimits>,
}Expand description
Serializable representation of sandbox state
Fields§
§fs: Vec<FsCapState>Filesystem capabilities
unix_sockets: Vec<UnixSocketCapState>AF_UNIX socket capabilities (may be absent in states persisted
by older nono builds; #[serde(default)] preserves backward compat).
net_blocked: boolWhether network is blocked
resource_limits: Option<ResourceLimits>Resource ceilings (memory and max processes). Absent in states from older
nono builds; #[serde(default)] keeps those loadable. Plain numbers, so
unlike paths they need no re-validation.
Implementations§
Source§impl SandboxState
impl SandboxState
Sourcepub fn from_caps(caps: &CapabilitySet) -> Self
pub fn from_caps(caps: &CapabilitySet) -> Self
Create state from a capability set
Sourcepub fn to_caps(&self) -> Result<CapabilitySet>
pub fn to_caps(&self) -> Result<CapabilitySet>
Convert state back to a capability set
Paths are re-validated through the standard constructors (new_dir/new_file)
which canonicalize paths and verify existence. This prevents crafted JSON from
injecting arbitrary paths that bypass validation.
Returns an error if any path no longer exists or fails validation.
Trait Implementations§
Source§impl Clone for SandboxState
impl Clone for SandboxState
Source§fn clone(&self) -> SandboxState
fn clone(&self) -> SandboxState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more