Wado

WEP: core:process — Running Host Programs Without Extending Authority

Context

A Wado program has no way to run another program. A build script, a test that calls git, a tool that wraps a compiler: each needs one, and each is stuck.

WASI has no process interface moving through its subgroup. Wado is the one to propose it, so this WEP designs the WIT as a WASI proposal from the start.

A child runs outside the Wasm sandbox

A Wasm guest reaches only what its host grants. A native child process reaches whatever the user who started the host can reach. Without OS confinement, granting spawn grants the user's whole authority. Deno documents its --allow-run this way: allowing a subprocess is allowing everything, and the permission system no longer holds. Node's --allow-child-process carries the same warning.

A list of program names is not a boundary

Allowing git but not sh looks like a limit and is not one. A permitted program turns into arbitrary code through its own arguments and environment:

Denylisting these is a race against every program's option parser. The boundary has to be the OS confining the child, or an explicit statement that the child is fully trusted. An allowlist can only record intent.

Decision

The rule: spawning never extends authority

A child is confined to the guest's own grants plus a fixed system baseline. A host that cannot confine a child does not offer process spawning at all.

This one rule carries the security model. It is the wado host's policy, not the interface's contract: the WIT says only that a host confines a child as its own policy says. Everything Wado would otherwise manage follows from it and is left out:

The host sandbox is the last line of defense

#[ambient(E)] and a user-written #[cm("…")] redeclaration can each reach Process without the effect showing in a signature. Wado does not close these. The effect makes intent visible; it is not the security boundary.

The wado CLI will also run arbitrary Component Model .wasm, including untrusted modules that no Wado compiler produced. For those the language is no boundary at all, so the host sandbox must hold on its own. Development effort goes to the sandbox.

A sandbox layer of Wado's own in wado-host

wado-host implements the sandbox itself rather than depending on a crate. Three reasons:

The policy is the subset both OS mechanisms express, so the two backends agree everywhere but the rows the table marks not restricted. On Linux it is roughly what Seatbelt provides on macOS:

To restrict macOS (Seatbelt) Linux
Read and write, per subtree file-read* / file-write* Landlock
Metadata, per subtree file-read-metadata not restricted
Exec, including by a grandchild process-exec Landlock EXECUTE
Network network-outbound / network-inbound seccomp on socket
Signals and abstract sockets isolated by default Landlock scopes
UNIX sockets by path network-outbound seccomp on socket
Leaving the process group not restricted seccomp
Typing into the terminal file-ioctl seccomp on ioctl
Inherited, cannot be lifted yes yes

On Linux, seccomp covers what Landlock does not:

Starting a confined child

The parent wado runs wasmtime on several threads. Between fork and exec, a multithreaded process may make only async-signal-safe calls: no allocation, no lock. Each backend fits the confinement into that rule without re-executing wado, so a host embedded in another binary spawns as wado does.

Landlock takes each rule as a descriptor rather than a path. The rules for the guest's grants come from the descriptors of its preopens, which the host already holds, so no path is resolved a second time between the check and the use.

The macOS profile's text holds no path. A fixed base in the host's source is followed by one rule per grant, (subpath (param "P0")), and each path reaches it as a parameter, -D P0=/path. No path is spliced into SBPL, so no escaping can rewrite the policy. Seatbelt matches the real path, so each parameter is one: the path a grant's descriptor names (F_GETPATH), or the baseline path canonicalized. A path is resolved through a link only where the link itself can be read. So each link that resolving a grant's path reads shows its metadata and nothing else: the links the path names, and the links those lead through. An example is /Applications/Xcode.app on a machine with several Xcodes. The profile allows file-ioctl only for what a program does with a terminal it inherits: setting its mode and asking its line discipline and foreground group. TIOCSTI stays refused, so no input reaches a terminal.

sandbox-exec reports a program it cannot start only on its own stderr, so the host checks that the program exists before spawning it.

Descriptors

A child inherits descriptors 0, 1 and 2 and nothing else. Confinement mediates what a child opens, never a descriptor it already holds, which keeps the access it was opened with whatever the child's grants. Rust's standard library opens every descriptor with O_CLOEXEC, but the descriptors wado itself inherited from its parent carry no such flag.

Escape tests

Writing the sandbox in-house obliges escape tests in CI on Linux and on macOS. Each of these must fail: reading a file outside the grants, writing under a read-only subtree, executing a binary outside the grants, executing one through a grandchild, a TCP connection or a UDP datagram when the network is not granted, connecting to a UNIX socket by path, a descendant surviving its group's kill (on Linux), pushing input into an inherited terminal, escaping through a symbolic link or .., and reading through a descriptor the host held open across the spawn. On macOS, a grant whose path holds ", \ or ) must confine to exactly that path.

Where it is offered

The host offers spawning only where the kernel can enforce the rule, and never in a weaker form:

ABI 6 shuts out some current long-term-support kernels. Ubuntu 24.04's general availability kernel (6.8) does not qualify; its hardware enablement kernel does.

Two ways to leave it out

A world leaves the interface out by not importing it, as the Kiln generators' world does. That is WASI's link-time capability model. The Component Model has no optional import yet: a host that does not supply an import refuses to instantiate the component, even one that would never spawn. So the wado host links the interface wherever its world imports it, also under --deny-process and on a kernel that falls short.

There, the interface answers at run time. get-availability returns available, denied (the host turned it off) or unsupported (the OS cannot confine a child), with no side effect. The two refusals call for different remedies, a host flag for one and a newer OS for the other, so an option getter in the style of wasi:cli's get-terminal-stdin, which merges them into none, says too little.

Every other function of the interface requires get-availability to answer available, and traps otherwise. The answer is fixed when the host starts, so one query settles it for the instance's lifetime, and spawn's error-code carries only failures of the one spawn. The WIT cannot state this as a contract, so its documentation does.

System baseline

A native program reads paths a Wasm guest never needs: its loader, its shared libraries, its locale data. The baseline is that set, and it is the one way a child may read more than the guest. It is defined, not open-ended:

Purpose Linux macOS
Loader and shared libraries /lib* /usr/lib, /System, the dyld cache
Installed programs /usr, /bin, /sbin, /nix/store /usr, /opt/homebrew, /opt/local, the developer tools
System configuration /etc, name resolution and TLS certificates among it /private/etc, the shell /bin/sh runs
Name resolution and certificate trust (network only) nothing beyond /etc mDNSResponder, trustd
Locale and time zones /usr/share/zoneinfo, locale data the same
Devices /dev/null, /dev/urandom, /dev/tty when inheriting the same, and /dev/fd with /dev/stdin, /dev/stdout and /dev/stderr
System and own process state /proc/cpuinfo and the other system-wide entries, /proc/sys, the child's own /proc/<pid> nothing: macOS answers through sysctl
Scratch a private HOME and TMPDIR per spawn, removed at exit the same

Grants

Diagnostics

The guest learns a failure as an error-code or an exit status. The host knows more, and says it on its own stderr, with the fix where one exists:

Each warning prints once per run however often the guest repeats the spawn.

Landlock answers a refused path with EACCES and leaves no record the host can read; its audit log needs CAP_AUDIT_READ. So the trace watches the calls rather than the refusals. The filter refers each call Landlock mediates (open, execve, mkdir, unlink, rename, link, truncate and their at forms) to the host with SECCOMP_USER_NOTIF_FLAG_CONTINUE. A host thread reads the path from the child's memory and resolves it as the kernel does for the child: against its working directory or the descriptor the call names, one component at a time, with /proc/self naming the child. A link in a process's /proc entry (cwd, fd/N) leads to an object rather than its text, so its text counts only where it still names that object. The thread leaves out a call that fails before Landlock's hook, as its flags and the spelling of its path decide. A trailing / or . asks a lookup for a directory and has it follow a link, and each call that removes or moves an entry treats the / its own way. The thread checks the rest against the policy where Landlock does: a call that makes, removes or moves an entry on the directory holding it, an open on the file, an exec on the program and on each interpreter it needs. The host reads an interpreter only where it is a regular file, the one kind exec runs, so a FIFO the child names cannot hold the host's thread. A call whose path the host may not read, under Yama's ptrace_scope or from a non-dumpable process, is not reported as refused: a warning says the trace missed calls, and why. The kernel then runs the call, and Landlock judges it as it would have. Moving enforcement itself to seccomp was rejected: the path a call names can change after the host reads it, and no filter can emulate execve.

WIT

The interface ships as core:process@0.1.0, as core:eval and core:kiln ship theirs, written in the shape a WASI proposal takes. Its WIT sits in lib/core/process/, with the wasi:filesystem WIT it uses under deps/. Claiming wasi: before the subgroup adopts it would promise compatibility Wado cannot keep with other hosts. On adoption only the namespace changes.

The specification is the core:process module documentation, generated into stdlib-core-process.md, with the WIT's own comments for the interface. What follows is why it takes the shape it does.

The timeout is the guest's

An earlier draft carried timeout: option<u64> in command, with a timed-out exit status. At the deadline the host sent SIGTERM to the group, then SIGKILL after a grace period the host set. It held while the guest was blocked reading a stream, which was its reason to exist.

It was removed. A deadline is a policy, and the guest already has every piece of it: exit is a future, wasi:clocks has a timer, and child has kill. A host-side timeout fixed the policy's shape (one deadline, one grace, a host option for the grace) and wrote SIGTERM into the interface.

Two pieces were missing, and were added instead:

Child::wait_timeout and Child::stop build the policy from those, in core:process rather than in every host. A guest blocked reading a pipe still cannot watch the clock; it reads in a set beside the timer, as output reads stdout and stderr together.

core:process

The cmd template

cmd`…` builds an argument vector without a shell, so a hole never runs as shell syntax and splits only as its type says: a List<String> hole is one argument per element, and any other hole is one argument. Its rules are in the cmd documentation. It can still be read as an option: a value starting with - is one to the program, so a hole that may hold one goes after -- where the program accepts it.

Deliberate omissions

Roadmap

Known gaps