Skip to content

Security

A codec is someone else’s code: a vendor’s, a community author’s, a customer’s. The runtime is built on the assumption that it is hostile.

A codec cannot Because
Read or write files, open a connection, read the environment Its WebAssembly instance imports nothing but the host API, whose calls are pure
Run past its time wasmtime’s epoch interruption, one tick a millisecond, checked inside the engine’s own loops (a backtracking regex included)
Take more memory than its limit QuickJS’s allocator limit, and a cap on the instance’s linear memory
Recurse without end wasmtime’s stack limit ends it as a trap
Affect another codec, or its own next call Each call that fails drops its instance whole; the next starts from the engine’s snapshot
Take the service down A panic in the host ends that call as an error; four codecs looping at once leave the others answering

A native module that imports anything outside pulzr:codec/v1 (WASI, another version, an unknown call) is refused before it runs.

build-serve runs rustc on a source it is given. The source cannot run code at compile time (no Cargo, no build scripts, no procedural macros: the only crate it may use is the SDK), but it can read files with include_bytes! and include_str!, and burn CPU. So:

  • rustc runs with an empty environment, under ulimit (2 GB, 60 s of CPU), with a 60 s deadline;
  • it builds one source at a time by default, in a directory with an unguessable name readable by its own user alone, removed afterwards, so a source cannot read another caller’s;
  • deploy it where there is nothing to read: no secrets in its environment or on its disk, no service account token, a read-only root (Deploying).

Raise BUILD_WORKERS only where every caller may read every other caller’s code.

Run it with PULZR_CODEC_AUTH=oidc wherever anyone but you can reach it. Without authentication it binds 127.0.0.1 unless BIND says otherwise, and with neither set it refuses every call.

Privately: Security, Report a vulnerability on the repository, or email security@pulzr.net. Never in a public issue. You will hear back within three working days.