Lion Cipher Lab

Sandbox untrusted code with WebAssembly and WASI (build the plugin host, prove the boundary)

Why it matters

Sooner or later a real system has to run code it does not trust: a customer-supplied plugin, a marketplace extension, a user-submitted function at the edge, one tenant's job on hardware shared with another tenant's. The old answers are heavy and leaky. A whole container or virtual machine per untrusted snippet is slow to start and large to run, and it still shares a kernel whose entire syscall surface is now attack surface. A language-level sandbox -- a restricted interpreter, a `seccomp` filter bolted onto a process -- is a deny-list you have to get exhaustively right, and the history of…

What you'll learn

Steps in this lab

  1. The idea: code with no powers, and one window you open on purpose
  2. Set up: install the runtime, make one file
  3. Write the untrusted modules, by hand, in the WebAssembly text format
  4. Act 1 -- run untrusted compute with an EMPTY sandbox, and contain an overflow
  5. Act 2 -- deny by default: reach for a capability nobody granted, then grant exactly one
  6. Act 3 -- grant ONE directory with WASI, and prove the '../' escape is denied
  7. Act 4 -- the other half of sandboxing: stop a runaway from taking the host down
  8. Run it: read the whole boundary in one pass of real output
  9. The judgment: when to reach for wasm, and how to do it better
  10. Honest limits: what this sandbox does NOT protect you from

Open the full interactive lab →