Skip to main content

Crate evalbox_sandbox

Crate evalbox_sandbox 

Source
Expand description

evalbox-sandbox: Sandbox orchestration

This crate provides secure sandboxed execution of untrusted code on Linux. It combines multiple isolation mechanisms for defense in depth:

  • User namespaces - Unprivileged containers, UID 0 inside = real user outside
  • Mount namespaces - Private filesystem view with minimal bind mounts
  • Pivot root - Change root directory, unmount host filesystem
  • Landlock - Filesystem and network access control (kernel 5.13+)
  • Seccomp-BPF - Syscall whitelist (~40 allowed syscalls)
  • Rlimits - Resource limits (memory, CPU, files, processes)

§Quick Start

use evalbox_sandbox::{Executor, Plan};

let plan = Plan::new(["echo", "hello"]);
let output = Executor::run(plan)?;
assert_eq!(output.stdout, b"hello\n");

§Requirements

  • Linux kernel 5.13+ (for Landlock ABI 1+)
  • User namespaces enabled (/proc/sys/kernel/unprivileged_userns_clone = 1)
  • Seccomp enabled in kernel

Re-exports§

pub use executor::Event;
pub use executor::Executor;
pub use executor::ExecutorError;
pub use executor::SandboxId;
pub use monitor::Output;
pub use monitor::Status;
pub use plan::Landlock;
pub use plan::Mount;
pub use plan::Plan;
pub use plan::Syscalls;
pub use plan::UserFile;
pub use resolve::resolve_binary;
pub use resolve::ResolvedBinary;
pub use resolve::ResolveError;

Modules§

executor
Sandbox executor for both blocking and concurrent execution.
isolation
Isolation mechanisms for sandboxed processes.
monitor
Process monitoring and output collection.
plan
Sandbox execution plan.
resolve
Binary path resolution and mount detection.
sysinfo
System information and path detection.
validate
Input validation for sandbox execution.
workspace
Workspace and pipe management for sandboxed execution.