3 releases (1 stable)
| 1.0.0 | Aug 13, 2025 |
|---|---|
| 0.2.0 | Jan 14, 2025 |
| 0.1.0 | Dec 18, 2024 |
#201 in Security
Used in erudite
18KB
265 lines
leucite
A library for sandboxing and limiting command execution through Linux landlock and prlimit.
Example
// Execute `bash -i` in the `/tmp/foo` directory using the provided rules
Command::new("bash")
.arg("-i")
.current_dir("/tmp/foo")
.env_clear()
.restrict(
Rules::new()
.add_read_only("/usr")
.add_read_only("/etc")
.add_read_only("/dev")
.add_read_only("/bin")
.add_read_write("/tmp/foo")
.into()
)
.max_memory(MemorySize::from_mb(100))
.spawn()?
.wait()?;
Dependencies
~0.8–3.5MB
~67K SLoC