Exploring user-space sandboxing for third-party install scripts (macOS, Rust)
⚓ Rust 📅 2026-02-22 👤 surdeus 👁️ 1Hi all,
I’ve been experimenting with building a user-space sandbox layer in Rust to execute third-party install scripts (typically distributed as remote shell installers) inside an isolated environment on macOS.
The idea is to constrain their side effects without modifying the scripts themselves.
Current prototype approach:
-
Environment redirection
- Rewrite HOME and XDG_* into an isolated directory
- Shadow shell config paths
-
Command restriction
- Block privilege escalation commands
- Restrict execution to a limited set of allowed tools
-
macOS sandbox profile
- Use sandbox-exec to prevent filesystem writes outside the isolated directory
The main design questions I’m exploring:
- Is command-level restriction fundamentally too brittle compared to syscall-level filtering?
- Given that sandbox-exec is deprecated, what would be a modern macOS-compatible alternative?
- Would capability-style isolation be feasible in a CLI context?
I’m especially interested in hearing from people who have worked on process isolation, security tooling, or CLI infrastructure in Rust.
If anyone is curious about experimenting further in this space, I’d be happy to collaborate.
1 post - 1 participant
🏷️ Rust_feed