# Sandbox covers child processes only and fails closed Status: accepted ## Context Bash, LSP servers, lens runners and test runners are spawned as child processes. File tools run inside the hx process, so a process-level sandbox cannot confine them. The hx process also holds the LLM API access and OAuth tokens and must stay outside the sandbox. ## Decision Every sandboxed spawn goes through `sandbox::command`, a drop-in for `Command::new`. With the sandbox off it is a plain command. With it on, the program runs under `bwrap` (Linux) or `sandbox-exec` (macOS): filesystem read-only except the project dir and `rw`, `$HOME` hidden except `ro`/`rw`, no network unless `network`, environment filtered. File tools call `guard_read` / `guard_write` themselves. If `mode = on` and no backend works, startup errors instead of silently running unsandboxed. ## Consequences In-process tools need explicit guards. A misconfigured host refuses to start rather than giving a false sense of safety. Code: crates/hx-core/src/sandbox.rs (module doc, `command`, `guard_read`, `guard_write`, init)