Airlock – crash isolation for Swift on macOS without fork()
Airlock is a Swift library that provides crash isolation for macOS applications without relying on fork(), allowing developers to run untrusted code safely by isolating it in a separate process.
Background
- Airlock is a new Swift library by Maxim Kotliar that lets developers run untrusted code safely inside a sandboxed helper process, even though macOS has deprecated the traditional `fork()` system call.
- On macOS, Apple has been discouraging `fork()` (used by many sandboxing tools), so Airlock uses `posix_spawn()` instead — a more modern, macOS-friendly way to launch a child process.
- The key idea is "crash isolation": if the sandboxed code crashes or does something malicious, the main app stays alive. This is similar to how web browsers run each tab in a separate process.
- This matters for macOS developers who need to run user-supplied plugins, scripts, or AI-generated code without risking the stability or security of their app.