pub struct SandboxConfig {
pub timeout_ms: u64,
pub max_memory_bytes: usize,
pub max_fuel: u64,
pub max_observations: usize,
pub max_scripts: usize,
pub max_script_bytes: usize,
pub max_total_script_bytes: usize,
pub drain_timers: bool,
pub max_timer_drains: usize,
pub allow_nested_wasm: bool,
pub nested_wasm_max_memory: usize,
pub nested_wasm_max_fuel: u64,
}Expand description
Configuration for a single sandbox execution.
Sensible defaults are provided. Zero config for consumers who just want
execute(scripts). Full control for experts.
Fields§
§timeout_ms: u64Maximum wall-clock execution time in milliseconds. Default: 200ms. Enough for most phishing kits. Set to 5000ms for complex extension analysis.
max_memory_bytes: usizeMaximum WASM linear memory in bytes.
Default: 16MB. QuickJS needs ~4MB for bootstrap.
max_fuel: u64Maximum fuel (WASM instruction count).
Default: 100_000_000 (~100ms of execution on modern hardware).
0 = unlimited (use timeout only).
max_observations: usizeMaximum observations before the sandbox stops recording.
Prevents memory exhaustion from observation floods.
Default: 10_000.
max_scripts: usizeMaximum number of scripts to execute per sandbox run. Default: 100.
max_script_bytes: usizeMaximum size of a single script in bytes. Default: 1MB.
max_total_script_bytes: usizeMaximum combined size of all scripts in bytes. Default: 5MB.
drain_timers: boolWhether to immediately drain all pending timers after script execution. When true, setTimeout/setInterval callbacks fire synchronously. Default: true (for detonation — you want to trigger delayed payloads).
max_timer_drains: usizeMaximum timer callbacks to drain per execution. Default: 50.
allow_nested_wasm: boolWhether to allow nested WASM instantiation.
When true, JS new WebAssembly.Module() creates a real nested WASM instance.
When false, it returns a stub that records the attempt but doesn’t execute.
Default: true.
nested_wasm_max_memory: usizeMaximum linear memory for nested WASM instances in bytes. Default: 4MB.
nested_wasm_max_fuel: u64Maximum fuel for nested WASM instances.
Default: 10_000_000.
Implementations§
Source§impl SandboxConfig
impl SandboxConfig
Sourcepub fn detonation() -> Self
pub fn detonation() -> Self
Config tuned for fast URL detonation (Sear). Low timeouts, drain timers, nested WASM disabled.
Sourcepub fn extension_analysis() -> Self
pub fn extension_analysis() -> Self
Config tuned for deep extension analysis (Soleno). Higher timeouts, nested WASM enabled, more observations.
Trait Implementations§
Source§impl Clone for SandboxConfig
impl Clone for SandboxConfig
Source§fn clone(&self) -> SandboxConfig
fn clone(&self) -> SandboxConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SandboxConfig
impl Debug for SandboxConfig
Source§impl Default for SandboxConfig
impl Default for SandboxConfig
Source§impl<'de> Deserialize<'de> for SandboxConfig
impl<'de> Deserialize<'de> for SandboxConfig
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>,
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
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>
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>
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