The plain version
You get a message in a language you cannot read, so you hire a translator. You do not let the translator into your house. You pass the message through a slot into a sealed room, and a card with numbers comes back through the same slot. If the translator falls asleep or panics, you shut the room and hire another.
A Sawbones plugin is that translator for a device's raw bytes. It cannot read a file, open a connection, tell the time or ask for anything. We built the room.
What merged
#234 added sawbones-plugin-host. The v0 plugin kind is a data-first decoder: a captured frame goes in, numbers come out. The interface is decoder.wit.
The checks
Zero imports. A plugin is a WebAssembly component (WASI 0.2) that imports nothing: no clock, randomness, files, sockets or handles. The host scans it before running anything and refuses it if it has any import, a nested component, a start function, a canonical built-in other than lift, an export other than decode and its types, or a size over the committed limits. It is checked three ways: the host-side scan, the sandboxed child's compile step and the linker, which defines nothing.
A child process. The runner, sawbones-plugin-runner, is spawned with an empty environment, working directory /, no arguments and stderr discarded. Before it reads the plugin's bytes it:
- asks to be killed if the host dies and marks itself non-dumpable, so a same-user process cannot read its memory;
- sets limits: no file writes, no new processes or threads, capped descriptors, address space and CPU time;
- builds the wasmtime engine, then installs a seccomp allow-list. Any system call outside the list kills the process, and the open family of calls returns an error. There is no socket, no ptrace and no execve.
Each frame then runs in a fresh store and instance, with fuel, a memory cap, a table cap and an instance cap. The host kills the child at its wall-clock deadline.
A hostile reply. What the child writes back is parsed as hostile bytes, bounded in size, with exact lengths. Every value is checked against the host's manifest and becomes an observation with no trust tier. A plugin cannot name a tier, a unit or a quantity in text; it returns an index and an integer with an exponent. A crash, trap, loop or allocation storm becomes a typed fault for that frame, and the host carries on.
A decoder seam
The Decoder trait is shared with sawbones-regmap, which decodes data-only register maps without any code. Many devices will need no plugin at all. A sample plugin, a few hundred bytes, is built and run in CI from plugins/sample-decoder.
Why this shape
An agent can write a plugin. An agent can also be fooled into writing a bad one. So the room has to be safe even if the translator is hostile, and what comes out must be treated as untrusted data, never as a claim about trust. This follows the project's rule that the Pi carries data but does not vouch for it. Plugins also never expose tools of their own: they emit typed effect requests that the policy engine classifies.
What is not done
Issue 177 tracks the remaining isolation: a separate unprivileged user, namespaces, Landlock and cgroups. We do not rely on them yet. Unprivileged user namespaces are restricted on the CI runners' image, and Landlock is absent from the Raspberry Pi 5 kernel defaults. The sandbox runs on Linux on x86-64 or aarch64 and the runner refuses to run elsewhere.
Links
- Plugins design page
- Sandbox source:
sandbox.rs,admission.rs - PR: #234