wasm_sandbox

command
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Example: wasm_sandbox runs an untrusted WebAssembly (WASI) module inside the pure-Go wazero-backed sandbox. WebAssembly gives strong isolation for free — the module runs in its own linear memory and can only touch the host through capabilities the sandbox grants (here: stdio and argv, nothing else).

The example compiles a tiny Go program to WASI on the fly, so it is fully self-contained and needs no external .wasm file. It requires the Go toolchain on PATH (it invokes `GOOS=wasip1 GOARCH=wasm go build`).

go run ./examples/wasm_sandbox/

To run your own module instead, build it to WASI and pass its path:

GOOS=wasip1 GOARCH=wasm go build -o prog.wasm ./yourprog
go run ./examples/wasm_sandbox/ prog.wasm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL