Skip to content

Can the Go daemons confine themselves on macOS?

Answered 2026-10-04. Decided 2026-10-04: A, the wb-launcher, with the wb-git shim. Source: X23-sandboxed-daemonsX23-sandboxed-daemons: Self-sandboxed Go daemons on macOSCan wb-netd, wb-proxyd and wb-hostd confine themselves at start with a sandbox profile, as S04-architecture says, while the Go runtime, inherited descriptors, and Keychain and Secure Enclave access in wb-proxyd keep w…, I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14). Affects S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves. and S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL.. The wb-proxyd Keychain part is I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04..

host: trusted code, confined anywaylaunchdLaunchAgentwb-hostd profilewb-hostdstate dirs, socketgitfallback, as spikedlauncherunconfined, fixed tablestarted firstown profile eachwb-vmdwb-netdwb-proxyddirect start: can’t re-confineVM: guest, untrustedwb-guestd, agentadversarial inputhost-guest socketEthernet frames

Figure 1. Option A. The launcher starts before wb-hostd confines itself. The daemons it starts can then each apply their own profile. A child that the confined wb-hostd starts directly (red) inherits the wb-hostd profile, and the kernel refuses its own (forbidden-sandbox-reinit). The git box shows the fallback, as the spike ran it: a child of wb-hostd inside its profile. Recommended option A instead starts git through the launcher, as a wb-git shim with a profile for one repository.

The spike settled the mechanism: an in-process profile, without cgo. The real choice is how wb-hostd starts the other daemons.

A. A launcher started before wb-hostd confines itself

Section titled “A. A launcher started before wb-hostd confines itself”

wb-hostd starts a launcher, wb-launcher, first, then confines itself. Later it asks wb-launcher for each daemon (wb-vmd, one wb-netd per VM, wb-proxyd) and hands it their descriptors. wb-launcher starts only those programs, and each confines itself first thing. It must hold to these conditions, which the spike’s looser launcher didn’t:

  • a separate standard-library-only program, not wb-hostd started in another mode;
  • requests over a SOCK_SEQPACKET or SOCK_DGRAM socketpair inherited at start, one fixed-format request per message, with unexpected descriptors closed and the request refused;
  • no arguments and a fixed environment for each program, with one bounded exception for wb-git (below);
  • profiles and their parameters compiled into each program, or taken from configuration wb-hostd read before it confined itself, never from a request;
  • a table of absolute paths in the installed bundle, never under <config>, <data> or <logs>, which the launcher checks;
  • an instance cap per program.

git starts the same way, as a wb-git shim that applies a profile for one repository and then runs git (recommended, not tried). The table has two fixed entries, wb-git-receive and wb-git-upload, so the git subcommand is never a free string. Besides its program, the request holds one field, the repository. wb-launcher accepts it only if it equals, after cleaning, <real path of the projects root>/<id>/<basename>, with a valid <id> and <basename> either landing.git or export.git. The launcher takes the root’s real path once, at start, and never resolves the request string, which could follow a planted symbolic link. The shim repeats the check before it confines itself. Seatbelt matches resolved paths, so a link swapped in after the check is denied (reproduced in the security review on PR65PR65 (merged): docs(spike): X23-sandboxed-daemons result, yes with conditionsResult of spike X23-sandboxed-daemons, approach steps 1 and 2 (the scope set by the 2026-10-04 decision on #34).). Instead of a path, wb-hostd could hand over a directory descriptor that the launcher checks with F_GETPATH.

The fallback is git as a child of wb-hostd under its profile, as the spike ran it. A git bug then reaches every project’s policy, the approvals in state.db, other projects’ landing repositories, and the audit log. If you choose it, that goes into T00-indexT00-indexboundary 6 is the host terminal stream. as an accepted residual risk.

wb-hostd starts the daemons directly. Each runs under the wb-hostd profile, which must then allow what every daemon needs.

Only wb-netd, wb-proxyd and wb-vmd confine themselves. wb-hostd starts them directly, as now.

wb-hostd asks launchd to start each daemon. They aren’t its children, so each can confine itself.

RequirementA. LauncherB. InheritC. hostd openD. launchd jobs
SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. least privilege on the hostevery daemonnetd too widehostd openevery daemon
wb-netd: only inherited descriptors (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.)measuredhostd’s rightsmeasuredplus a socket path
wb-hostd: its state directories onlymeasuredplus all othersnoneplus launchd
Descriptor hand-off (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.)as nowas nowas nowconnect back
Code and spec worksmall launchernonespec changelaunchd jobs
Details and glossary

Why in process, not sandbox-exec. With sandbox-exec, the profile is in force before the program is loaded. It must then also let the process read the system libraries and run its own binary, until the process exits. In process, the call comes after loading, and the profile only allows what the daemon does from then on. It also keeps the profile inside the binary, so the parent can’t swap it. That last point follows from the design and was not tested.

Why no cgo. cgo would make each macOS build need a C toolchain for macOS and stop cross-compiling from Linux or Windows. The spike calls the function through a few lines of Go assembly, the way the standard golang.org/x/sys/unix package calls the C library on macOS. That links to a function in package syscall (syscall6) which Go keeps for golang.org/x/sys and lets other packages use (syscall/syscall_darwin.go in Go 1.27, go.dev/issue/67401). A later Go release could restrict that, and the build would then fail rather than run unconfined.

Why git gets its own profile. The git gateway runs git upload-pack and git receive-pack on data the guest sends. Under the wb-hostd profile, a bug in git reaches everything in the wb-hostd directories: policy, approvals, every landing repository, the audit log. A wb-git shim with a profile for one repository limits it to that repository. Either way, git runs without the user’s git configuration, and the profile allows only the git installation (bin/git, libexec/git-core/, share/git-core/ and the libraries git links), not all of /opt/homebrew.

A gap this found. wb-hostd can’t read the user’s repository under its profile, which S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem. needs for the project clone. I67I67 (closed): wb-hostd can't read the user's repository under its sandbox profile (S08 upload-pack)Found in the review of #65 (X23-sandboxed-daemons result). has the options.

Glossary