Expand description
OS-level sandbox for subprocesses spawned on behalf of LLMs.
Linux uses env scrub, namespaces, Landlock, rlimits, seccomp, and optional cgroup v2 limits. macOS uses env scrub and Seatbelt.
ⓘ
use hanzo_sandbox::{detect, SandboxPolicy};
let sandbox = detect();
let policy = SandboxPolicy::default();
sandbox.harden(&mut cmd, &policy)?;Structs§
- Effective
Protection - What a
Sandboxcan enforce for a given policy after OS feature detection. - Null
Sandbox - Sandbox
Policy - Policy applied to a sandboxed process.
Enums§
- Network
Mode - Network access permitted to sandboxed processes.
- Sandbox
Error
Constants§
- DEFAULT_
MAX_ CPU_ SECS - DEFAULT_
MAX_ FILE_ SZ_ MB - DEFAULT_
MAX_ MEMORY_ MB - DEFAULT_
MAX_ OPEN_ FDS - DEFAULT_
MAX_ PROCS - SANDBOX_
ENV_ VAR - Environment variable that overrides the configured sandbox mode at runtime.
Accepted values:
auto,on,off. Case-insensitive.
Traits§
- Sandbox
- Applied to a
tokio::process::Commandbefore spawn and to the resulting PID after spawn. Implementations are platform-specific.