pub struct SandboxConfig {
pub max_execution_time: Duration,
pub max_memory_mb: u64,
pub max_cpu_percent: u64,
pub allowed_commands: HashSet<String>,
pub blocked_commands: HashSet<String>,
pub allow_network: bool,
pub max_processes: u32,
pub strict_mode: bool,
}Expand description
Configuration for sandbox execution.
Note: this sandbox provides command-level validation (whitelist,
blocklist, dangerous-pattern regexes) and environment-variable
filtering. It does NOT provide filesystem isolation — the command runs
in the caller’s working directory as a plain subprocess, so absolute
paths and .. sequences can reach anything the host user can reach.
If filesystem isolation is needed, use the Docker or Podman runtime.
Fields§
§max_execution_time: DurationMaximum execution time for commands
max_memory_mb: u64Maximum memory usage in MB
max_cpu_percent: u64Maximum CPU usage percentage
allowed_commands: HashSet<String>Allowed commands (whitelist)
blocked_commands: HashSet<String>Blocked commands (blacklist)
allow_network: boolWhether to enable network access
max_processes: u32Maximum number of processes
strict_mode: boolWhether to enable strict mode (more restrictive)
Trait Implementations§
Source§impl Clone for SandboxConfig
impl Clone for SandboxConfig
Source§fn clone(&self) -> SandboxConfig
fn clone(&self) -> SandboxConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SandboxConfig
impl Debug for SandboxConfig
Auto Trait Implementations§
impl Freeze for SandboxConfig
impl RefUnwindSafe for SandboxConfig
impl Send for SandboxConfig
impl Sync for SandboxConfig
impl Unpin for SandboxConfig
impl UnsafeUnpin for SandboxConfig
impl UnwindSafe for SandboxConfig
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more