You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,13 +122,10 @@
122
122
- the goal for WasmVM is full POSIX compliance 1:1 — every command, syscall, and shell behavior should match a real Linux system exactly
123
123
- WasmVM and Python are experimental surfaces in this repo
124
124
- all docs for WasmVM, Python, or other experimental runtime features must live under the `Experimental` section of the docs navigation, not the main getting-started/reference sections
125
-
- the WasmVM runtime requires standalone WASM binaries in `native/wasmvm/target/wasm32-wasip1/release/commands/`
126
-
- build them locally: `cd native/wasmvm && make wasm` (requires Rust nightly + wasm32-wasip1 target + rust-src component + wasm-opt/binaryen)
127
-
- the Rust toolchain is pinned in `native/wasmvm/rust-toolchain.toml` — rustup will auto-install it
128
-
- CI builds the binaries before tests; a CI-only guard test in `packages/wasmvm/test/driver.test.ts` fails if they're missing
129
-
- story-critical C-built Wasm fixtures also have CI-only availability guards in `packages/wasmvm/test/ci-artifact-availability.test.ts` and `packages/secure-exec/tests/kernel/ci-wasm-artifact-availability.test.ts`; if they fail, rebuild with `make -C native/wasmvm/c sysroot && make -C native/wasmvm/c programs`
125
+
-**All WASM command source code (Rust crates and C programs) has been moved to the agent-os-registry repo at `~/agent-os-registry/`** (GitHub: `rivet-dev/agent-os-registry`). The `native/wasmvm/` directory in this repo is the original copy and should no longer be the primary source for building commands. Build from the registry instead: `cd ~/agent-os-registry && make build-wasm`.
126
+
- the WasmVM runtime driver (`packages/wasmvm/`) still lives in this repo. It loads and executes WASM binaries but does not contain command source code.
130
127
- tests gated behind `skipIf(!hasWasmBinaries)` or `skipUnlessWasmBuilt()` will skip locally if binaries aren't built
131
-
-see`native/wasmvm/CLAUDE.md`for full build details and architecture
128
+
-the`native/wasmvm/` directory remains for reference and WASI host import definitions (`crates/wasi-ext/`), patches (`patches/`), and the C sysroot build
Copy file name to clipboardExpand all lines: docs-internal/arch/active-handles.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Problem
4
4
5
-
The sandboxed Node.js environment uses `isolated-vm` (V8 isolates) to run JavaScript code. Unlike real Node.js, isolated-vm does not have an event loop. Code runs synchronously and the sandbox exits immediately when the script finishes executing.
5
+
The sandboxed Node.js environment uses V8 isolates to run JavaScript code. Unlike real Node.js, the V8 isolate does not have an event loop. Code runs synchronously and the sandbox exits immediately when the script finishes executing.
6
6
7
7
This causes problems with async APIs that use callbacks:
8
8
@@ -31,7 +31,7 @@ In real Node.js:
31
31
4. Callbacks fire as events occur
32
32
5. Process exits when no more active handles remain
The main thread services all runtimes via the event loop. When a WasmVM Worker needs a file, it posts a message and blocks on `Atomics.wait`. The main thread handles the request and calls `Atomics.notify`. When a V8 isolate needs a file, the `ivm.Reference` suspends the isolate, the main thread resolves the promise, and the isolate resumes. No dedicated kernel worker needed.
93
+
The main thread services all runtimes via the event loop. When a WasmVM Worker needs a file, it posts a message and blocks on `Atomics.wait`. The main thread handles the request and calls `Atomics.notify`. When a V8 isolate needs a file, the Reference suspends the isolate, the main thread resolves the promise, and the isolate resumes. No dedicated kernel worker needed.
94
94
95
95
---
96
96
@@ -1031,7 +1031,7 @@ WasmVM internal docs stay with WasmVM. Only cross-project docs go to the top lev
Copy file name to clipboardExpand all lines: docs-internal/friction.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@
42
42
1.**[resolved]**`NodeRuntime` constructor ownership drifted between driver and direct adapter options.
43
43
- Symptom: runtime capability and config ownership was split across `NodeRuntime` fallbacks and `createNodeDriver`, which made permission defaults and runtime injection behavior harder to reason about.
44
44
- Fix: `NodeRuntime` now requires a `driver`, reads `processConfig`/`osConfig` from `driver.runtime`, and no longer accepts direct constructor adapters/permissions.
45
-
- Follow-up: a dedicated pass should continue moving remaining `isolated-vm` execution internals from `NodeRuntime` into the Node driver implementation.
45
+
- Follow-up: a dedicated pass should continue moving remaining V8 isolate execution internals from `NodeRuntime` into the Node driver implementation.
- Symptom: maintaining Worker/browser runtime paths during Node driver ownership changes increased refactor risk and cross-runtime drift.
48
48
- Fix: browser package exports were removed for this phase and browser entrypoints now return deterministic unsupported errors until follow-up restoration.
@@ -142,7 +142,7 @@
142
142
- Symptom: requests reached the sandbox server but responded `400`; root cause was `instanceof http2.Http2ServerRequest` checks throwing when `http2` constructors were undefined.
143
143
- Fix: added built-in `http2` compatibility stubs (`Http2ServerRequest`/`Http2ServerResponse`) and routed `require('http2')` / ESM `import 'http2'` to that stub module.
144
144
145
-
5.**[resolved]** Direct cloning of ESM module namespace objects failed in `isolated-vm`.
145
+
5.**[resolved]** Direct cloning of ESM module namespace objects failed in the V8 isolate layer.
146
146
- Symptom: using `entryModule.namespace.copy()` for `run()` exports failed with `[object Module] could not be cloned`.
147
147
- Fix: after ESM evaluation, bind the namespace in isolate scope and copy `Object.fromEntries(Object.entries(namespace))` to the host.
Copy file name to clipboardExpand all lines: docs-internal/glossary.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,4 @@
4
4
-**Runtime** — the full `secure-exec` execution environment including the isolate, bridge, and resource controls. `NodeRuntime` and `PythonRuntime` are the public entry points.
5
5
-**Bridge** — the narrow layer between the isolate and the host that mediates all privileged operations. Untrusted code can only reach host capabilities through the bridge.
6
6
-**SystemDriver** — config object that bundles what the isolate can access (filesystem, network, command executor, permissions). Deny-by-default. Built by `createNodeDriver()` or `createBrowserDriver()`.
7
-
-**Execution Driver** — host-side engine that owns the isolate lifecycle. `NodeExecutionDriver` (V8 via `isolated-vm`), `BrowserRuntimeDriver` (Web Worker), `PyodideRuntimeDriver` (Pyodide in a Node worker).
7
+
-**Execution Driver** — host-side engine that owns the isolate lifecycle. `NodeExecutionDriver` (V8 isolate), `BrowserRuntimeDriver` (Web Worker), `PyodideRuntimeDriver` (Pyodide in a Node worker).
Copy file name to clipboardExpand all lines: docs-internal/research/comparison/browser-node-runtimes.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,9 +89,9 @@ A comparison of tools that run Node.js-compatible code in browsers or sandboxed
89
89
90
90
### libsandbox (secure-exec)
91
91
92
-
**What it is:** A driver-based sandboxed Node.js runtime with two backends: `isolated-vm`for Node.js (V8 isolate-level isolation) and Web Workers for browsers. Designed for executing code snippets with controlled API access.
92
+
**What it is:** A driver-based sandboxed Node.js runtime with two backends: V8 isolates for Node.js (isolate-level isolation) and Web Workers for browsers. Designed for executing code snippets with controlled API access.
93
93
94
-
**Architecture:** A unified bridge layer provides Node.js APIs (fs, process, child_process, network, os) that work identically across both drivers. The Node driver uses `isolated-vm` to create V8 isolates with explicit `Reference`-based bridges. The browser driver uses Web Workers with `postMessage` communication. A permission system gates access to filesystem, network, child process, and environment operations.
94
+
**Architecture:** A unified bridge layer provides Node.js APIs (fs, process, child_process, network, os) that work identically across both drivers. The Node driver uses V8 isolates with explicit `Reference`-based bridges. The browser driver uses Web Workers with `postMessage` communication. A permission system gates access to filesystem, network, child process, and environment operations.
95
95
96
96
**Strengths:**
97
97
- Strong isolation on Node.js (V8 isolate — separate heap)
@@ -108,7 +108,7 @@ A comparison of tools that run Node.js-compatible code in browsers or sandboxed
108
108
- Browser driver isolation is weaker (Worker global scope is accessible)
109
109
- No npm package installation
110
110
- No real `node_modules` resolution (polyfills via node-stdlib-browser)
111
-
-`isolated-vm` is a native addon (complicates deployment)
111
+
-The V8 isolate package is a native addon (complicates deployment)
|**Node API coverage**| High | Moderate | Partial | Targeted |
@@ -138,7 +138,7 @@ A comparison of tools that run Node.js-compatible code in browsers or sandboxed
138
138
139
139
libsandbox occupies a distinct niche: **fast, secure, dual-environment code execution** rather than full development environment simulation. Key differentiators:
140
140
141
-
1.**Security-first**: libsandbox is the only option with real memory isolation (via isolated-vm) and a structured permission system. WebContainers relies on browser sandboxing; almostnode has no isolation.
141
+
1.**Security-first**: libsandbox is the only option with real memory isolation (via V8 isolates) and a structured permission system. WebContainers relies on browser sandboxing; almostnode has no isolation.
142
142
143
143
2.**Node.js as primary target**: libsandbox is designed to run on Node.js servers (for AI agent backends, code execution APIs) with browser as a secondary target. WebContainers and Sandpack are browser-first.
@@ -91,10 +91,10 @@ libsandbox uses `isolated-vm` (also V8 isolates) and shares some of the same pri
91
91
92
92
### 2. No OS-level sandboxing (MEDIUM-HIGH)
93
93
94
-
The host Node.js process has full OS access. If there is ever an isolated-vm escape (V8 bug), the attacker owns the host process with all its permissions. Cloudflare wraps everything in seccomp + empty namespaces.
94
+
The host Node.js process has full OS access. If there is ever a V8 isolate escape (V8 bug), the attacker owns the host process with all its permissions. Cloudflare wraps everything in seccomp + empty namespaces.
95
95
96
96
**Recommendation:**
97
-
- Document that isolated-vm alone is not sufficient for running untrusted code from the internet
97
+
- Document that V8 isolates alone are not sufficient for running untrusted code from the internet
98
98
- Provide guidance for users to run the host process in a container with minimal capabilities (`--cap-drop=ALL`)
99
99
- Consider optional integration with Linux namespaces or seccomp for the host process
100
100
@@ -117,7 +117,7 @@ The host Node.js process has full OS access. If there is ever an isolated-vm esc
117
117
118
118
Cloudflare blocks these during request handling because they make forensic analysis of exploits harder and expand the attack surface for V8 bugs.
119
119
120
-
**Recommendation:** Add an option to disable dynamic code generation in the isolate. `isolated-vm` may support this via V8 flags or by overriding these globals in the bridge.
120
+
**Recommendation:** Add an option to disable dynamic code generation in the isolate. The V8 isolate package may support this via V8 flags or by overriding these globals in the bridge.
121
121
122
122
### 5. No resource limits on child processes/network (LOW-MEDIUM)
0 commit comments