Skip to main content

Module sandbox

Module sandbox 

Source
Expand description

What a shell command can reach once it runs.

Approvals and shell_allowlist answer whether a command runs. This answers a different question: once it does, what can it touch — the machine’s files, its network, and the daemons it leaves behind. M8 called that gap the biggest one left, and the honest answer used to be “it is your machine, you asked for it”.

The mechanism is bubblewrap (bwrap): one binary, no daemon, no setuid bit, no configuration file, packaged by every mainstream distribution because Flatpak is built on it. It is never bundled with eclipse. It is looked for once, on PATH, and a mode that needs it refuses when it is missing rather than running without it — a security promise that degrades silently is worse than one that was never made.

  • process — a private PID namespace, filesystem untouched. Nothing the command starts outlives the call: when the run ends, PID 1 of that namespace dies and the kernel takes the rest with it. That closes the hole the cancellation work could not reach (a daemon that double-forks and is reparented to init) without a cgroup, and it costs one clone.
  • fs — the same namespace plus a read-only filesystem: / read-only, a fresh /tmp, the workspace and the scripts directory writable, shell_isolate_hide paths replaced by an empty directory, and the network optional. A build that writes outside the workspace (cargo into ~/.cargo, pip into ~/.cache) needs that path in shell_isolate_writable; that is a real cost, and the reason this mode is not the default.

Both modes are the same argv with different mount flags, so the argument list is built in one place and can be asserted in a test without bubblewrap installed.

Structs§

Plan
The program and arguments a run should actually invoke: the intended command, wrapped in bubblewrap when isolation is on.
Sandbox
Clonable because two places run under the same policy without being able to share one value: the agent’s tool registry and the interface’s !command.