Sandboxing and enforcement
Permissions decide whether a tool call may run. A sandbox limits what a command can reach once it runs. Each command below reaches for one thing; the last runs with no sandbox at all.
- go test ./...: reaches. The workspace and /tmp are bound writable.
- rm -rf $(go env GOROOT): read-only. System directories and toolchains are bound read-only.
- cat ~/.ssh/id_ed25519: not there. Credential paths are masked, even under a read-only bind of the home directory.
- echo x >> ~/.bashrc: not there. The home directory isn’t in the sandbox’s view, so the path doesn’t exist there.
- ps aux: sandbox processes. A new PID namespace with its own /proc: host processes, their command lines and environments are invisible.
- curl https://proxy.golang.org: relay → broker. The relay hands the request to the broker on the host, which checks the name, port and every resolved address before it connects.
- curl https://evil.example: refused. The broker refuses a destination the allowlist doesn’t name.
- cat ~/.ssh/id_ed25519: reaches. No launcher confines the command: it reaches whatever your user can.
Why rules aren’t enough
Section titled “Why rules aren’t enough”A permission rule can match the command it sees. A shell can also compute a path, invoke another program, or build a command that the rule cannot see in advance. Matching a command is useful, but it is not a security boundary.
A launcher supplies a separate boundary around the running process. It limits the filesystem and network available to the command and programs it starts. What it can guarantee depends on the launcher and its configuration.
What a sandbox confines
Section titled “What a sandbox confines”The usual profile gives a command a writable workspace and temporary directory. It exposes system programs and libraries read-only, along with selected toolchain directories. These grants let ordinary builds run without giving them the whole machine.
The home directory is normally hidden. On Linux, even if you add it with -sandbox-read-only ~/, credential paths such as .ssh and .aws remain masked. Other files in the added directory become readable, so grant only what the command needs.
Toolchains are bound read-only. A command can use an installed compiler without changing the host’s installation. On Linux, additional read-only paths can be supplied with repeatable -sandbox-read-only flags.
Go’s build cache is kept separate from the host cache. A command can write its own cache without poisoning files that a later host build might trust. The same goes for downloads: when the network is full or allowlist, Go’s module cache and cargo’s home belong to the sandbox, so go get and cargo fetch can download what is missing. Your own module cache stays read-only and is read first, so modules you already downloaded are not fetched again; your GOPROXY still decides where the rest comes from, except that a proxy whose URL embeds a user or password is left out, since the sandbox hides your credentials; a private module behind it fails with Go’s own message unless you pass GOPROXY with -env. Cargo does not read your downloaded crates, so it fetches them again. With the network off, nothing is downloaded and your read-only caches are used as they are. Git receives only user.name and user.email from the user’s configuration, rather than configuration that could cause it to run host-selected programs.
Launchers
Section titled “Launchers”bwrap confines commands on Linux; seatbelt uses macOS sandbox profiles. On supported Windows 11 builds, mxc uses Microsoft Execution Containers. none supplies no boundary. The table describes command enforcement; network modes are explained below.
| Launcher | Platform | reads | writes | network | credentials | other processes | resources |
|---|---|---|---|---|---|---|---|
| none | Any | none | none | none | none | none | none |
| bwrap | Linux | enforced | enforced | off / allowlist / full | enforced | enforced | none |
| seatbelt | macOS | enforced | enforced | off / full | advisory | none | none |
| mxc | Windows | enforced | enforced | off / allowlist (advisory) / full | advisory | enforced | none |
Enforced means the launcher supplies a boundary for that dimension. Advisory is weaker. Seatbelt restricts filesystem access to credentials, but other processes and some system services remain reachable, so its credential isolation is advisory. It has no process namespace: a command can still see other processes. MXC denies Credential Manager access. DPAPI can decrypt blobs the workload can read, so MXC credential isolation is advisory. Drive names and metadata can be visible outside explicit grants. The launchers impose no resource limits.
Windows setup
Section titled “Windows setup”Run zelk sandbox setup and review Microsoft’s telemetry before agreeing.
For non-interactive setup, pass -accept-telemetry. Setup installs the signed,
pinned Windows executor under the state directory. Use
zelk sandbox setup -verify to check the installation without running it.
zelk sandbox status does the same check and says “MXC is not set up”
and exits 0 when nothing is installed; other failures exit non-zero. Select it with -sandbox mxc or save "sandbox": "mxc" in your settings.
zelk’s tests for mxc have run on Windows 11 26H2 (build 26300.9974) with
MXC 1.1.0, and that is the combination zelk supports. Microsoft also lists
Windows 11 24H2 from build 26100.9278 and 25H2 from 26200.9278; zelk has not
tested them. If MXC can’t run the sandbox’s checks on a host, zelk reports
the sandbox as unavailable.
Keep the state directory outside your workspace. MXC supports workspaces
under your Windows profile by letting PowerShell traverse the directories
leading to the workspace. The policy denies ungranted siblings using a
fresh directory listing for each command. Entry names and metadata can
remain visible. New entries can lack an explicit deny until the next
command, while MXC still restricts access to file contents.
Git for Windows’ git.exe works in MXC. Git Bash fails during MSYS2
startup, so zelk offers only PowerShell while MXC is active. Verify, Watch,
and session hooks with no shell choice use PowerShell too. Session hooks
run on the host. Startup rejects -bash (including alternate executables),
-no-powershell, and trusted hooks that specify "shell": "bash". Use
PowerShell or select -sandbox none to use Bash where policy permits it.
MXC tracks the Git Bash startup issue.
Telemetry
Section titled “Telemetry”Microsoft’s MXC executor sends Required telemetry to Microsoft only on
Windows when zelk runs commands in the mxc sandbox. zelk itself sends
nothing. Linux (bwrap), macOS (seatbelt) and Windows with -sandbox none
send no MXC telemetry.
MXC.ExecutionStartandMXC.ExecutionEndreport the sandbox kind, backend, denial-capture mode, exit code, outcome, duration, failure reason and phase.MXC.Errorreports the sandbox kind, backend, error type, exit code and phase.MXC.ProcessExitedreports an opaque process identity, process ID and exit code.
Each event includes a random session ID, version, release channel and privacy tags. Microsoft documents that these events exclude command lines, environment values, complete file paths, account names, tokens and sandbox output.
zelk, Windows settings and administrator policy cannot turn this telemetry
off. To avoid it, run without the mxc sandbox. Setup shows this notice and
requires agreement before downloading or running the executor. The first
sandboxed session also shows a reminder once per state directory.
Microsoft’s MXC telemetry documentation · Microsoft Privacy Statement
Network
Section titled “Network”A sandbox defaults to network off. Choose full to share network access, or use an allowlist with bwrap or MXC to permit selected destinations. Full access is not a network boundary. Without a sandbox, the default is full access.
zelk -sandbox bwrap -network-allow proxy.golang.org -network-allow '*.github.com'Each -network-allow adds a destination and selects allowlist mode unless -network was set. The wildcard matches subdomains, not github.com itself. The default ports are 80 and 443; a rule can specify a port. Seatbelt supports off and full, and combining allowlist entries with off or full is an error.
In allowlist mode, a command sends HTTP or CONNECT traffic to zelk’s egress broker. bwrap reaches it through an in-sandbox relay, and MXC reaches it through a loopback TCP endpoint. The broker checks the requested host and port, resolves the host, and checks the resulting addresses before connecting. Redirect destinations are checked again.
On Windows, DNS lookups through the Windows DNS client remain unfiltered under MXC allowlist mode. Commands can resolve arbitrary names and send data in those queries. MXC denies direct outbound TCP and other host loopback TCP/UDP. zelk displays the DNS caveat the first time this mode starts for a state directory. The managed browser under MXC supports off and full network modes without Chrome’s own sandbox, keeps host loopback closed, and refuses -browser-local and allowlist mode.
Private, loopback, link-local and metadata addresses are refused, even if a name is allowed. The broker limits proxied traffic by destination and passes the payload through. Under a sandbox, WebFetch and HTTP MCP servers follow the same network setting. A listed loopback address can be used by an HTTP MCP server on the host, though sandboxed commands cannot reach it through the broker.
Requiring a boundary
Section titled “Requiring a boundary”Choose -sandbox bwrap, -sandbox seatbelt or -sandbox mxc to request a launcher. If the launcher cannot start with its required profile, construction fails instead of silently running the command unconfined.
An administrator can set "sandbox": "required" in a managed policy. The host selects the platform launcher, or fails if none is available. A Go host can use WithRequirements to require specific enforcement capabilities when constructing the agent; construction fails if the environment does not provide them.
Unattended runs
Section titled “Unattended runs”Pair auto mode with a sandbox for unattended work. Auto mode uses a reviewer to decide calls that would otherwise ask a person. The sandbox limits what an approved command can reach, including when the reviewer makes a mistake. On Linux, an auto-mode run with -input deny selects bwrap by default unless a sandbox was explicitly chosen. On Windows, unattended auto mode uses MXC when setup and telemetry agreement are verified and the launcher can start, and prints a one-line notice that commands are sandboxed, as on Linux. Otherwise it reports that commands run unconfined and tells you how to set up MXC. A managed requirement always needs a working sandbox.
What it doesn’t cover
Section titled “What it doesn’t cover”The launchers do not impose resource limits. A sandboxed command can still consume resources available to it. Use separate operating system controls if the run needs resource bounds.
Custom Go tools, MCP tools and client-hosted tools are outside the command launcher’s enforcement report. A stdio MCP server is started through the environment, so the launcher confines its process like any command’s; what an HTTP server does on its own host is beyond any sandbox, and a Go tool runs inside the host process with the host’s access. Local file tools use the path jail instead of the subprocess launcher.
On macOS, sandbox-exec is not a public Apple API. Its behavior depends on the system version, so check the supported profiles and tests before relying on it.
Where to go deeper
Section titled “Where to go deeper”The enforcement contract describes the launcher profiles, network broker and escape tests. The CLI permissions guide explains how to configure permissions and boundaries together.