Skip to content

How it is enforced

Two layers.

  1. The compiler checks every call against needs and rejects a script that asks for more.
  2. The runtime compiles the program to WebAssembly and runs it on Wasmtime with WASI. A WASI program has no files, network or clock unless the host hands it a handle, so even a bug in the compiler cannot let it touch the machine.

Starting a command goes through a host function that checks the run patterns first, because WASI cannot start processes itself.

Target Sandbox Build effort Startup Portability
WebAssembly (WASI) strong, capability-based medium fast one .wasm runs anywhere
JavaScript on Deno medium, flags low medium needs Deno
Own bytecode VM whatever you build high fast one runtime to ship
Native (LLVM, Cranelift) none on its own high fastest per platform
Transpile to Rust or Go none on its own medium slow (compile step) per platform

A tree-walking interpreter with run-time checks behind a single Host interface, so the WebAssembly backend can reuse the same checks.