procjail · open source · MIT
Run untrusted code without handing it your machine.
AI-generated code, user submissions, third-party plugins, a binary you just downloaded: sooner or later your program has to execute something it does not trust. procjail is a Rust library that wraps that execution in the strongest sandbox the host can offer, so the answer to "what could this code touch" is "almost nothing".
Use it
cargo add procjail
git clone https://github.com/santhreal/procjail && cd procjail && cargo build --release
Best available containment, chosen per host
Sandboxing on Linux is not one mechanism, it is a pile of them with different strengths and different availability. procjail probes the host and picks in order:
- bubblewrap - full namespace isolation: filesystem, network, PIDs, users.
- firejail - profile-based containment where bubblewrap is absent.
- unshare - raw namespace isolation when no helper binary exists.
- rlimits - the floor: CPU, memory, file size, and process count caps that work everywhere.
On top of whichever strategy wins, procjail applies the same invariants: secret environment variables are stripped before the child sees them, a watchdog timeout kills runaway processes, and the call returns resource usage (CPU time, peak memory) alongside the exit status.
Who uses it
procjail is the containment layer inside the Santh fleet. Sear, our URL detonation tool, runs headless Chromium inside a procjail sandbox for phishing analysis and malware triage. keyhog uses it when scanning needs to execute anything it does not control. It works standalone: one dependency, one trait, no daemon.
Get it
github.com/santhreal/procjail - source and issues. The crate is on crates.io.