Isolation
Read this before you run code you don't trust. The first wall is the same everywhere: the guest is an emulated machine. Its only ways out are its terminal, its files and, if the site has one, the network relay. Guest code never runs as host code.
Around the emulator, each place a site runs adds its own wall:
| Browser | Native | Docker | |
|---|---|---|---|
| Around the emulator | the browser's renderer sandbox | no_new_privs, Landlock and seccomp on Linux; Seatbelt on macOS | read-only root, no capabilities, memory and pid limits |
| Host files | none | reads the site; writes its cache, socket, logs and a job's workspace | the site, read-only; logs if given |
| New processes | none possible | refused | inside the container only |
| Network | the page's fetch() and WebSocket | out the way your machine goes; private addresses off | the same, from the container |
| Needs | a browser | nothing (Linux or macOS) | Docker |
The native sandbox
The native sandbox is strongest on Linux with Landlock (kernel 5.13 or later).
- A run says which parts of the sandbox it got.
SNOWGLOBE_SANDBOX=strictrefuses to run without all of them.snowglobe-vm sandbox-checktries what a run must not be able to do and reports each;sandbox-check --jobdoes the same for a job forked by a serving process.
A serving process (--serve, and every template of snowglobe daemon) runs the
jobs of everyone who sends it one, so each forked job is narrowed further before any of its code
runs:
- It reads and writes its own workspace and nothing else of the jobs root: not another job's files, environment or output.
- It writes nothing the server shares between jobs. The JIT profile the server compiled from is
read only, and a job's own compiling is never saved into it, so what one job (one team) ran
can't shape, or be inferred from, how fast another's starts. The server's logs are closed in
the job before it runs and aren't writable to it, and its stdout and stderr (the template's
log, under the daemon) point at
/dev/null: what a job prints is in its answer only, whatever it writes to the guest's consoles. The profile learns only from the operator'stemplate add --warmruns; the daemon'sjob.endedevent, with the job's labels, is the per-job record. - It connects to no Unix socket: not its server's control socket, nor another machine's. On Linux seccomp refuses to make one at all; on macOS Seatbelt refuses to connect one (the system's DNS resolver's excepted, for a job with a network).
macOS is a development platform for snowglobe, not a multi-tenant one: Seatbelt has no
equivalent of seccomp's system-call filter or of Landlock's stacking, and what is enforced there
is checked by sandbox-check rather than built into the kernel the way Linux's is. Run
other people's jobs on Linux.
Shared memory stays private
Native runs of one site share its snapshot's memory (how). The
first run writes it to the cache as a read-only image, in ram/, which only you can open.
Every run maps it copy-on-write.
- A page a machine writes becomes its own, so one machine never sees another's memory.
- Each restore gets fresh randomness: the guest kernel reseeds on it.
- The image is named by a hash of the whole snapshot and checked before use: yours, read-only, one
link. Anything off, and the run restores the usual way.
SNOWGLOBE_RAM_IMAGE=offalways does.
What none of them do
- Hide a site's contents from whoever runs it. The snapshot is theirs to read.
- Make network access safe beyond the rules on Networking. Give a guest a network only when the work needs it.