Skip to content

S04 - Architecture

Purpose: Name the processes, the boundaries between them, and which requirement each boundary serves.

Requirements: SEC01-separate-kernelSEC01-separate-kernel: Separate kernelThe agent runs in a hardware-virtualized guest with its own kernel, never sharing a kernel with the host or with another environment of the user (for example a WSL distribution)., SEC02-no-host-fs-shareSEC02-no-host-fs-share: No host filesystem sharingNo host directory is mounted into the guest, read-only or otherwise., SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable., SEC15-no-guest-disk-mountSEC15-no-guest-disk-mount: The host never mounts a guest-written diskA disk image is guest-written once a guest has run with it attached, and every copy or clone of a guest-written image is guest-written too.

Tests: C11-host-daemonsC11-host-daemons: Host Daemons, Audit, and DisksThe test cases for the host daemons' own checks: wb-vmd's device set and slots, the image build bundle, supervision, the accounting and event channels, the daemon log pipes, the audit writer, free space, and the data…, C01-network-and-dnsC01-network-and-dns: Network and DNSThe test cases for the guest's network path: the link endpoint, addressing, and the DNS gateway with its hold, quiet refusals, and negative answers.

Briefs: B29-vsock-handoffB29-vsock-handoff: Can wb-vmd hand guest connections to our Go daemons as descriptors, also across a restore?Yes, with conditions., B34-sandboxed-daemonsB34-sandboxed-daemons: Can the Go daemons confine themselves on macOS?Yes, with conditions., B48-process-supervisionB48-process-supervision: Who restarts the host processes, and what happens to running VMs when one fails?Recommended that wb-hostd supervises the other daemons, that VMs are saved when wb-hostd stops and restored when it starts, and that every guest-facing handler gets a per-VM limit., B64-vmd-sandboxB64-vmd-sandbox: Can wb-vmd confine itself and still run a macOS VM?Yes, with conditions.

host: trusted, runs as the user, no root terminal: wb claude … wb the only CLI · TTY relay gRPC wb-hostd sessions · git gateway policy store · approvals audit log · VM admission gRPC wb-vmd platform-native VM provider macOS: Swift, Virtualization no policy · build password only NIC descriptor starts and stops VMs wb-netd userspace TCP/IP (gVisor) DHCP · DNS no secrets · no outbound streams wb-proxyd HTTP policy credential replacement dependency gate fetches what it injects allowlisted only wb-guestadmin wbadmin passwords only one build, rotation or cleanup, then exits write-only Internet work VM: guest, untrusted (v1: macOS) host-guest socket virtual NIC crosses: socket (vsock) crosses: frames wb-guestd (root) project user A clone + worktrees claude · tools project user B clone + worktrees claude · tools no secrets no host mounts no other devices wb-guestd starts every process as a project user; each project has its own user. isolated VM (optional) same wiring, own policy isolated projects, --isolated
The processes on the host and in the guest. Two channels cross the VM boundary: the host-guest socket, which wb-hostd terminates, and Ethernet frames, which wb-netd terminates.

Exactly two channels cross the VM boundary: the host-guest socket (vsock on macOS and Linux, Hyper-V sockets on Windows; terminated by wb-hostd) and Ethernet frames (terminated by wb-netd). There is no shared directory, no NAT to the host network, and no other device that carries data (SEC01-separate-kernelSEC01-separate-kernel: Separate kernelThe agent runs in a hardware-virtualized guest with its own kernel, never sharing a kernel with the host or with another environment of the user (for example a WSL distribution)., SEC02-no-host-fs-shareSEC02-no-host-fs-share: No host filesystem sharingNo host directory is mounted into the guest, read-only or otherwise., SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.).

Page What it covers
S04-01-design-principlesS04-01-design-principles: Design PrinciplesThe design decisions that every host and guest process follows. The rules every process follows: one CLI, a Go core, an untrusted guest, policy checked twice, one work VM
S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from. How wb-vmd hands over guest connections and the NIC, the fixed device set, and stream identity in wb-proxyd
S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS. How each host daemon confines itself, and wb-launcher
S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk. One wb-vmd per VM, wb-vmd-layer, wb-vmd-recipe and wb-diskfmt
S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh. wb-guestadmin, wb-release-check, wb-download and wb-build-ssh
S04-06-git-confinementS04-06-git-confinement: Git and the `wb-hostd` ProfileHow git runs on data from the guest, what the wb-hostd profile lets it write, and what wb takes from wb-hostd. The wb-git shim, the wb-hostd profile, and what wb takes from wb-hostd
S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages. Who starts whom, when wb-hostd stops, upgrades and daemon restarts
S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. Accounting and event records, version skew, host work the guest can cause, logs
S04-09-netd-startS04-09-netd-start: Starting `wb-netd`How wb-hostd starts and stops each VM's wb-netd, what the program inherits, its profile, and what it does before its start message. How wb-hostd starts and stops each VM’s wb-netd, its descriptors, profile and first frames
S04-10-vmd-installS04-10-vmd-install: Installing macOS in `wb-vmd`The wb-vmd-install entry of an image build: its install rules, the restore image it reads, the build bundle it installs into, and its Install call. wb-vmd-install: the install rules, the restore image, the build bundle, the build password pipe and the Install call
S04-11-vmd-startS04-11-vmd-start: Starting `wb-vmd`What wb-vmd inherits from its spawner, the socket it serves gRPC on, its lifeline, and the checks on each connection. How wb-vmd is started: its descriptors, its gRPC socket, the lifeline and the peer checks
S04-12-descriptor-passingS04-12-descriptor-passing: Passing DescriptorsHow one host process passes an open socket to another: who holds it when, how the receiver shows it holds it, when the sender closes its copy, and what a lost or bad acknowledgment does. How one host process passes a socket to another: who holds it when, acknowledgments, and the macOS socket collector
Process Lang Runs as Holds Faces the guest via Purpose
wb Go user, per invocation nothing, and no store access; for wb cred set the value it reads, until it has written it to wb-credset (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.) none The only CLI: dispatcher for every command, TTY relay for agent sessions (S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command.)
wb-credset Go user, one run per wb cred set, rm or list, started by wb, then exits the binding/* secret store items it writes, deletes or lists, and nothing else none Open the store, confine itself (S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS., “wb-proxyd and the secret store on macOS”), then do one store operation: write the value from its standard input, delete an item, or list item names (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.)
wb-hostd Go per-user service policy, landing repos, state host-guest socket Sessions, git gateway, approvals, audit writer, admission control (S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does., 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., S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.)
wb-launcher Go, standard library only user, started by wb-hostd before it confines itself (macOS only) nothing none Start the programs in its fixed table when wb-hostd asks, so that each can confine itself (S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS., “Each host daemon is self-sandboxed”)
wb-git Go user, per git gateway transfer, started through wb-launcher (on macOS) (B34-sandboxed-daemonsB34-sandboxed-daemons: Can the Go daemons confine themselves on macOS?Yes, with conditions.) nothing pack data from the guest, through wb-hostd Confine itself to one repository (for a push, also reading the export.git it borrows from), then run git receive-pack or git upload-pack (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.)
wb-prover Go user, per boundary check (at wb trust and for an approval request whose result isn’t cached), started through wb-launcher (on macOS); instance cap one per VM plus one for wb trust nothing repository policy, and a host name the guest asked for in an approval request, both through wb-hostd Set its memory cap, confine itself to its inherited descriptors (the two documents and the result pipe), check the prover binary’s hash, then run openshell-prover check with fixed arguments (S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.)
wb-vmd platform-native user, one per VM, spawned for wb-hostd (through wb-launcher on macOS, as wb-vmd-work, wb-vmd-isolated, wb-vmd-install for an image build, wb-vmd-layer for its Claude Code layer, or wb-vmd-recipe for a named image’s recipe) its VM’s handles; during an image build, the provisioning password on a pipe until the start call returns (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.) none (devices only) Create, start, stop, save, and restore its VM; hand guest socket connections and the NIC endpoint to other processes (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.)
wb-netd Go user, one per VM, spawned for wb-hostd (through wb-launcher on macOS) nothing Ethernet frames Network stack, DHCP, DNS, stream hand-off; for the build VM only, one connection to the guest’s port 22, whose socket it sends to wb-hostd (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., S07-18-build-networkS07-18-build-network: Build NetworkThe build VM's network: what its wb-netd serves, the one connection to the guest's port 22, and its refusal for session VMs.)
wb-proxyd Go user, spawned for wb-hostd (through wb-launcher on macOS) the binding secrets of the VM’s sessions, fetched just in time, the CA key items, and the use of the CA signing key (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.) streams from wb-netd HTTP policy, credential replacement, dependency gate, upstream connections (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., S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.)
wb-guestadmin Go user, one run per image build, wbadmin rotation or cleanup, started through wb-launcher (on macOS), then exits the wbadmin/* secret store items it writes and fetches, and nothing else one write-only host-guest connection to wb-guestd; pipes to the build’s wb-vmd and wb-build-ssh The admin side of the image build, wbadmin rotation at each VM’s first contact, and removing the items of images and system disks that are gone (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.)
wb-build-ssh Go user, one run per image build, started through wb-launcher (on macOS), then exits the build password on its standard input, for one session one SSH session to the build guest’s port 22, over a socket that wb-netd connects on the build VM’s own network Confine itself, then run the build’s one install session as wbadmin with Go’s SSH library, and write sudo -S’s password into the session’s standard input (S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh., S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.)
wb-diskfmt Go user, one run per new data disk, started through wb-launcher (on macOS) as wb-diskfmt-work or wb-diskfmt-isolated, or per Xcode disk as wb-diskfmt-xcode, then exits nothing none: it runs before any guest has run with the disk (SEC15-no-guest-disk-mountSEC15-no-guest-disk-mount: The host never mounts a guest-written diskA disk image is guest-written once a guest has run with it attached, and every copy or clone of a guest-written image is guest-written too.) Confine itself to its slot’s bundle, then create, attach, format and detach that VM’s new data disk (S06-13-data-disk-formatS06-13-data-disk-format: Data Disk FormatHow the host formats a VM's new data disk, the one exception SEC15-no-guest-disk-mount makes, and the checks before a VM starts with its disk.), or the build bundle’s Xcode disk (S06-15-xcode-diskS06-15-xcode-disk: The Xcode DiskHow the host builds the read-only disk that holds Xcode and the simulator runtimes for an image build, under the wb-diskfmt shim's profile, and what the build records.)
wb-release-check Go user, one run per image build, started through wb-launcher (on macOS); instance cap one per build, then exits nothing none: it reads bytes from downloads.claude.ai that wb-download fetched, on inherited descriptors Confine itself to its inherited descriptors, check a Claude Code release’s manifest signature, version, platform entry, size and SHA-256, and write the result to its result channel, a socket (S14-01-installS14-01-install: InstallHow the image build downloads Claude Code on the host, checks it, and installs it in the guest image, and which version a guest runs., S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh.)
wb-download Go user, one run per download for an image build, started through wb-launcher (on macOS); instance cap one per entry, then exits nothing none Confine itself, then fetch over HTTPS, from the hosts compiled into its entry only, a macOS restore image, a Claude Code release or Apple’s Command Line Tools into files wb-hostd opened for it (S17-03-downloadsS17-03-downloads: DownloadsHow wb-download fetches what an image build needs from the internet.)
wb-guestd Go root / SYSTEM inside the guest nothing n/a (runs in the guest) Users, PTY exec, git transport (S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does.)
wb-guestroot Go root inside the guest, a daemon apart from wb-guestd nothing n/a (runs in the guest); its own port below 1024, which wb-hostd opens only for wb vm admin A root shell on a PTY for the person at the host’s terminal (S15-05-admin-pathS15-05-admin-path: The Admin PathHow the person at the host's terminal gets a root shell in their own guest, on a path that no agent, session, or guest process can start or reach.)

Native user-interface helpers (notifications with actions, later a tray or menu-bar item) are separate small processes per platform. They render approval requests and return the user’s answer to wb-hostd, and decide nothing themselves (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.).

Locations follow each OS’s conventions (paths in 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 logical layout is the same everywhere:

<config>/ user-editable configuration (S09-policy-credentials-audit)
config.toml global settings and defaults
policy.yaml global network policy (S09-policy-credentials-audit)
projects/<project-id>.toml per-project settings but placement and config_trust, toolchain manifest reference
projects/<project-id>.policy.yaml per-project network policy
images/<name>.toml the recipe of a named image (S06-vm-lifecycle)
<data>/
images/ base images (copy-on-write clones)
images/macos-restore.ipsw the restore image a macOS image build installs from, fetched by wb-download (S17-install-and-upgrade)
images/macos-restore.ipsw.partial the restore image while it downloads
downloads/ a Claude Code release, or the Command Line Tools, during an image build (S14-claude-in-guest, S17-install-and-upgrade)
images/macos-build.noindex/ the build VM's bundle, new for each image build, never listed as an image (S06-vm-lifecycle)
vms/<guest-os>-{work,isolated}.noindex/ VM bundles: disks, machine identity, saved state
projects/<project-id>/export.git bare repo the guest fetches from: selected refs only, written only by wb (S08-workspace-and-git)
projects/<project-id>/landing.git bare repo receiving session branches (S08-workspace-and-git)
state.db SQLite: the last VM generation of each slot (S04-02-vm-provider), projects with their key, identity, placement and config_trust (S05-04-naming), the project users of each data disk, their ID counter and the pending user removals (S06-03-image-updates), sessions, approvals, caches, the Go clock's point and tree heads (S07-egress-gateway), each VM's placeholder set until the VM is deleted (S09-policy-credentials-audit), each VM's CA records, the removal list of CA keys, on Linux whether the CA key is in a TPM (S09-policy-credentials-audit, S15-least-privilege), and the catalog entry of the restore image (S17-install-and-upgrade). Migrated by wb-hostd only, with its backups next to it as state.db.v<N>.bak (S17-install-and-upgrade). Mode 600
run/ user-only directory for local IPC endpoints
<logs>/ audit JSONL, and one log per host process, <process>.log and its rotated files, all written by wb-hostd (S04-08-records-and-bounds)

Every message between processes is protobuf. A request with a reply goes over gRPC. On the host it runs over a local IPC endpoint only the user can open: Unix sockets in a 0700 directory on macOS and Linux, named pipes with an ACL for the user’s SID on Windows. The peer’s identity is checked on every connection. To the guest it runs over the host-guest socket.

On macOS the endpoints are in internal/platform/localipc:

  • The run directory is made with mode 0700 when missing. One that isn’t a directory of the user without group or other permission bits, or is a symbolic link, is refused with ipc-run-dir-unsafe and left as it is.
  • An endpoint is <data>/run/<name>.sock. A listener holds an exclusive lock on <name>.lock for its life, and a second one is refused with ipc-endpoint-in-use. The lock holder removes a leftover socket of the user that refuses a connect, before its bind. Its close removes the socket before it releases the lock, so no listener removes another’s socket. A socket that answers is refused with ipc-endpoint-in-use, and any other file at the path with ipc-endpoint-unsafe.
  • Both ends check the other’s user ID, the listener on every accepted connection and the dialer after its connect. A peer of another user ID is closed with ipc-peer-uid before a byte is read, and the listener goes on to the next connection.
  • The gRPC handshake refuses a connection that didn’t come through these checks with ipc-peer-unchecked.

gRPC can’t pass a descriptor. So a hand-off of descriptors is one record per message on a socketpair inherited at spawn (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “Hand-off on macOS”).

The .proto files in proto/ are the one contract for every language (S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice.):

File Package Holds
proto/wraithbox/vmd/v1/vmd.proto wraithbox.vmd.v1 VMService, served by wb-vmd and called by wb-hostd, and HandoffMessage and HandoffAck, the records of the hand-off channel
proto/wraithbox/guest/v1/guest.proto wraithbox.guest.v1 GuestService, served by wb-guestd and called by wb-hostd. Its Shell runs the terminal stream to the guest, and its SetTime sets the guest clock
proto/wraithbox/hostd/v1/hostd.proto wraithbox.hostd.v1 HostService, served by wb-hostd on its local IPC endpoint and called by wb
proto/wraithbox/hostd/v1/shell.proto wraithbox.hostd.v1 ShellService, served by wb-hostd on the same endpoint and called by wb shell, for the terminal stream
proto/wraithbox/hostd/v1/project.proto wraithbox.hostd.v1 ProjectService, served by wb-hostd on the same endpoint and called by wb, for project records (S05-04-namingS05-04-naming: NamingHow wb identifies a project, a session and its branch, and how projects are registered, checked, moved and removed.)
proto/wraithbox/terminal/v1/terminal.proto wraithbox.terminal.v1 The frames of the terminal stream (S16-terminal-streamS16-terminal-stream: Terminal StreamHow wb guards boundary 6 of T00-index, the guest output that wb writes to the user's terminal., S05-02-exit-status-and-signalsS05-02-exit-status-and-signals: Exit Status and SignalsWhat wb claude exits with, and what it does with each signal.), the same on both hops. wb-hostd builds each frame it passes on new from a checked one
proto/wraithbox/diskfmt/v1/diskfmt.proto wraithbox.diskfmt.v1 The messages between wb-hostd and wb-diskfmt, one per datagram on wb-diskfmt’s socketpair (S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk., “wb-diskfmt”)
proto/wraithbox/egress/v1/handoff.proto wraithbox.egress.v1 The messages of a VM’s hand-off socket between wb-netd and wb-proxyd (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps.)
proto/wraithbox/egress/v1/control.proto wraithbox.egress.v1 The messages of the control channels between wb-hostd and wb-netd and wb-proxyd (“Control channels”)
proto/wraithbox/egress/v1/accounting.proto wraithbox.egress.v1 The accounting records that wb-netd and wb-proxyd write to wb-hostd (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Accounting and event channels”)

A refusal over gRPC names its rule in a google.rpc.ErrorInfo detail, as the reason, so the caller needn’t parse the message text. The comments on each message from the guest, on HandoffMessage, and in wraithbox.egress.v1 state the bounds the receiver checks.

wb-netd and wb-proxyd each inherit a control channel from wb-hostd at spawn: a socketpair of fdchan.Socketpair(4096), as for the other descriptor channels. Each end sends the version record first. The first message from wb-hostd is the daemon’s start message, ProxydStart or NetdStart, and it comes once. A daemon refuses another message before it, and a second one, and ends the channel. wb-hostd treats a message from a daemon that it refuses as a crash of that daemon (S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages.).

wb-hostd logs a refused message with control-message-refused, and a channel that fails with control-channel-failed. From wb-proxyd, it also refuses an acknowledgment it didn’t ask for and a CA reply, because it doesn’t send a CA request yet (I583I583 (closed): wb-hostd: run the CA keeper: boot order at VM start, ProxydStarted, the rotation tick and host wakeNamed by the code review of #581 (finding 1), which builds #507.). An acknowledgment that comes after its call gave up is logged and ignored.

A record is at most 4 KiB and carries at most one descriptor. A payload that doesn’t fit (an effective policy, a kept name mapping, the wildcard sets) goes as the read end of a pipe. It holds a 4-byte length and one protobuf message, and the reader refuses one over 64 MiB or not whole within 10 seconds. wb-hostd sends the read end first, then writes the payload in a goroutine of its own under the same 10-second bound. A write that fails or times out is a crash of that daemon. control.proto lists the messages of each direction, and internal/egressmsg checks them.

wb runs as the user, but what it sends wb-hostd about a project comes from a repository, which anyone can have written. So wb-hostd checks each field of a ProjectService request before it reads state.db (SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.). A field over its cap is refused with project-request-over-cap, and a field outside its form with project-request-form. The refusal and its log name the field.

Input from wb Limits
A gRPC message 4 MiB each way
The project key the native realm only, a clean absolute path of at most 4,096 bytes of UTF-8 without a control character
The URLs of an identity 1,024, each 1 to 8,192 bytes of printable ASCII without a space, 1 MiB together
The root commits of an identity 1,024, each a 40- or 64-character lowercase object ID
A project id and name 32 lowercase hexadecimal characters, and a name of S05-04-namingS05-04-naming: NamingHow wb identifies a project, a session and its branch, and how projects are registered, checked, moved and removed. of at most 64 bytes
Matching projects in a reply 64, with the full count, and 8 ids in the refusal of an ambiguous name

On a host stream connection, gRPC included, each side sends its version record first, then reads the peer’s (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Between host processes”). On a datagram channel the first record is the version record. The Go side is internal/hostversion. Go and Swift write the same bytes:

  • the four bytes WBV1;
  • one length byte;
  • that many bytes of the build version, 1 to 64 bytes, each from 0x20 to 0x7E. A length of 0 is an unstamped build, which has no version.

The reader takes at most 69 bytes, under a deadline of a few seconds (the value is in code). Until the peer’s record has passed, it hands nothing the peer sent to gRPC, and sends the peer nothing but its own record. Each refusal closes the connection and logs both versions, with its rule:

Rule When
peer-version-timeout no whole record before the deadline: the peer sent none, the connection ended first, or the peer didn’t take this side’s record
peer-version-malformed another magic, a length over 64, a version byte outside 0x20 to 0x7E, or, on a datagram channel, a first record that isn’t exactly one version record
peer-version-unstamped the peer’s version is empty, or its own is empty or outside the form
guest-version-form the peer’s version is not in the version form of S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “The guest’s version is a label” (the rule Go’s version check names)
peer-version-mismatch the versions differ as bytes

Status: Draft