snowglobe

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:

BrowserNativeDocker
Around the emulatorthe browser's renderer sandboxno_new_privs, Landlock and seccomp on Linux; Seatbelt on macOSread-only root, no capabilities, memory and pid limits
Host filesnonereads the site; writes its cache, socket, logs and a job's workspacethe site, read-only; logs if given
New processesnone possiblerefusedinside the container only
Networkthe page's fetch() and WebSocketout the way your machine goes; private addresses offthe same, from the container
Needsa browsernothing (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=strict refuses to run without all of them.
  • snowglobe-vm sandbox-check tries what a run must not be able to do and reports each; sandbox-check --job does 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's template add --warm runs; the daemon's job.ended event, 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=off always 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.