pub struct SandboxPolicy {
pub profile: SandboxProfile,
pub allow_read: Vec<PathBuf>,
pub allow_write: Vec<PathBuf>,
pub allow_network: bool,
pub allow_exec: Vec<PathBuf>,
pub env_inherit: Vec<String>,
}Expand description
Declarative sandbox policy evaluated at command launch.
Applied after blocklist, PolicyGate, and TrustGate have accepted the call.
The sandbox is the last hard boundary, not a replacement for application-level controls.
Fields§
§profile: SandboxProfileThe enforcement profile controlling which restrictions are active.
allow_read: Vec<PathBuf>Paths granted read (and execute) access. Normalized to absolute paths at construction.
Paths are resolved to their canonical (real) form by SandboxPolicy::canonicalized
before being applied. If a path is a symlink, the resolved target is used for the allow
rule. Deny rules for well-known secret paths are also generated for the canonical form,
so the allow override works correctly even when the denied path is a symlink.
allow_write: Vec<PathBuf>Paths granted read and write access. Normalized to absolute paths at construction.
allow_network: boolWhether unrestricted network egress is permitted.
allow_exec: Vec<PathBuf>Additional executables or directories granted execute permission.
env_inherit: Vec<String>Environment variable names or prefixes that are inherited by the sandboxed child.
Implementations§
Source§impl SandboxPolicy
impl SandboxPolicy
Sourcepub fn canonicalized(self) -> Self
pub fn canonicalized(self) -> Self
Canonicalize all path fields so that symlinks and .. components cannot bypass
the policy. Paths that cannot be resolved (e.g., non-existent) are dropped and
logged at WARN level with the OS error — callers should ensure paths exist
before adding them to the policy.
Trait Implementations§
Source§impl Clone for SandboxPolicy
impl Clone for SandboxPolicy
Source§fn clone(&self) -> SandboxPolicy
fn clone(&self) -> SandboxPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more