evalbox_sandbox/lib.rs
1//! evalbox-sandbox: Sandbox orchestration
2//!
3//! This crate provides secure sandboxed execution of untrusted code on Linux.
4//! It combines multiple isolation mechanisms for defense in depth:
5//!
6//! - **Landlock v5** - Filesystem, network, signal, and IPC access control
7//! - **Seccomp-BPF** - Syscall whitelist (~40 allowed syscalls)
8//! - **Seccomp User Notify** - Optional syscall interception for FS virtualization
9//! - **Rlimits** - Resource limits (memory, CPU, files, processes)
10//! - **Capabilities** - All capabilities dropped, `NO_NEW_PRIVS` enforced
11//!
12//! No user namespaces required — works inside Docker with default seccomp profile.
13//!
14//! ## Quick Start
15//!
16//! ```ignore
17//! use evalbox_sandbox::{Executor, Plan};
18//!
19//! let plan = Plan::new(["echo", "hello"]);
20//! let output = Executor::run(plan)?;
21//! assert_eq!(output.stdout, b"hello\n");
22//! ```
23//!
24//! ## Requirements
25//!
26//! - Linux kernel 6.12+ (for Landlock ABI 5)
27//! - Seccomp enabled in kernel
28
29#![allow(clippy::cast_possible_truncation)]
30#![allow(clippy::cast_sign_loss)]
31
32pub mod executor;
33pub mod isolation;
34pub mod monitor;
35pub mod notify;
36pub mod plan;
37pub mod resolve;
38pub mod sysinfo;
39pub mod validate;
40pub mod workspace;
41
42pub use executor::{Event, Executor, ExecutorError, SandboxId};
43pub use monitor::{Output, Status};
44pub use plan::{Landlock, Mount, NotifyMode, Plan, Syscalls, UserFile};
45pub use resolve::{ResolveError, ResolvedBinary, resolve_binary};