Skip to content

S13-02 - Layer 2: Seatbelt Filesystem Profile (v1)

Purpose: The Seatbelt profile each session’s process tree runs under, where it comes from, its exceptions for Xcode builds, and its known gaps.

Each session’s process tree runs under a Seatbelt profile (sandbox_init). The kernel enforces it, children inherit it, and a process can’t remove it, much like Landlock.

Reads are denied by default, with an allowlist for:

Writes are allowed only in the user’s home, the session worktree, and temporary directories.

No profile of this layer runs simulators (“Xcode build profile” and “Known gaps” below).

The profile is generated from policy on the host and installed by wb-guestd. The repository never supplies it.

The profile denies AF_VSOCK sockets with (deny system-socket (socket-domain AF_VSOCK)). A project user’s processes then can’t open, bind, or listen on vsock and pose as wb-guestd (X27-vsock-confinementX27-vsock-confinement: vsock confinement of project usersCan a non-root process in a macOS guest open AFVSOCK, and bind or listen on wb-guestd's port while wb-guestd is running or being restarted?). socket() fails with EPERM.

A second control backs it: wb-guestd’s port is below 1024, which the guest kernel lets only root bind. That also holds for project processes outside the profile (S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself., “The port”, and “Known gaps” below).

The host doesn’t rely on either to keep the guest from dialing in. It doesn’t register a vsock listener, and it opens every connection itself (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., B29-vsock-handoffB29-vsock-handoff: Can wb-vmd hand guest connections to our Go daemons as descriptors, also across a restore?Yes, with conditions.).

A project user’s requests to the host go to wb-guestd over a local Unix socket, where the peer user ID names the project user. Attribution fails closed (SEC08-proj-isolationSEC08-proj-isolation: Per-project isolationEach project has its own guest user, state and history, and one project cannot persist into another., SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.):

  • wb-guestd refuses a peer user ID that isn’t an active, unlocked project user of this VM. Examples are root, a system account, a user ID created at runtime, and a locked project user. It logs the refusal with the rule.
  • wb-hostd refuses a request for a project that isn’t in the VM’s effective policy.

The agent-safehouse profiles are the starting point (X24-openshell-artifactsX24-openshell-artifacts: OpenShell artifactsDo the OpenShell parts that S07-egress-gateway, S09-policy-credentials-audit and S10-tech-stack build on exist in the assumed form, under a permissive license, at a version that can be pinned: the networkpolicies sche…): Apache-2.0, v0.12.0, commit 6bded066.

  • They are Seatbelt profile modules that start from (deny default), with placeholders for the home and work directories.
  • Upstream joins them with a shell script and applies them with sandbox-exec.
  • Wraith Box copies the modules it uses at the pinned commit, and keeps their license text. It generates the profile on the host.

Their network module allows every outbound IP connection, so this layer doesn’t narrow egress, and the host enforces it (S07-egress-gatewayS07-egress-gateway: Egress GatewayThe only path from a guest to any network: a userspace network stack (wb-netd) and a policy-enforcing proxy (wb-proxyd) on the host.).

X24-openshell-artifactsX24-openshell-artifacts: OpenShell artifactsDo the OpenShell parts that S07-egress-gateway, S09-policy-credentials-audit and S10-tech-stack build on exist in the assumed form, under a permissive license, at a version that can be pinned: the networkpolicies sche… read the profiles but didn’t run them in a guest. X27-vsock-confinementX27-vsock-confinement: vsock confinement of project usersCan a non-root process in a macOS guest open AFVSOCK, and bind or listen on wb-guestd's port while wb-guestd is running or being restarted? ran, in a guest, the modules that upstream’s renderer selects by default, for the vsock calls only.

Builds, SwiftPM and signing get these exceptions and no others (X06-guest-xcodeX06-guest-xcode: Guest users and XcodeCan builds and simulators run for a guest user without a GUI login?):

  • reads of /Library/Preferences/com.apple.dt.Xcode.plist, /Library/Developer and /Library/Keychains;
  • lookups of com.apple.SecurityServer and com.apple.security.syspolicy.

The generator emits exactly these exceptions. Its tests run every Xcode build task under the profile, a build for a simulator destination included. A build task that fails under it gets its missing rule through a spec change that names the rule.

Under the base and build profiles, simctl can’t reach CoreSimulatorService, so simulators and iOS tests don’t run in a confined session.

Processes started through LaunchServices and launchd services run outside the profile. They stay inside the guest and the project user’s permissions.

Simulators are outside every profile of this layer (X06-guest-xcodeX06-guest-xcode: Guest users and XcodeCan builds and simulators run for a guest user without a GUI login?):

A process can leave its session’s POSIX session with setsid while another session of the same project runs in the VM. It then survives its session’s hangup and kill (S13-01-process-hardeningS13-01-process-hardening: Layer 1: Process Hardening (v1)How wb-guestd hardens every process it starts for a project user, and how it stops and kills a project user's processes.). It keeps the project user’s rights and the VM’s network grants until the project’s last session ends. It can still write to the worktree while the WIP commit runs. wb-guestd logs it, and C09-guest-and-sessionsC09-guest-and-sessions: Guest and SessionsThe test cases for what a project user can reach inside the guest, wb-guestd's update and the guest clock, the shared toolchain prefix, the guest admin password, and the session lifecycle. checks the log.

  • Why: the network rules alone aren’t enough. (deny network*) stops bind and connect on vsock but not socket(), and the agent-safehouse modules allow every system-socket.

Status: Draft