procjail · open source · MIT
Run untrusted code in a sandboxed subprocess.
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.
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 Linux namespace isolation. A namespace gives the process a private view of the filesystem, network, and process table.
- 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 used across the Santh tools. 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.