How it is enforced
Two layers.
- The compiler checks every call against
needsand rejects a script that asks for more. - 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.
Why WebAssembly
Section titled “Why WebAssembly”| 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 |
First version
Section titled “First version”A tree-walking interpreter with run-time checks behind a single Host interface, so the WebAssembly backend can reuse the same checks.