Skip to content

Commit 99a97f4

Browse files
NathanFlurryclaude
andcommitted
docs: add permanently unsupported features section to Node.js compatibility
Lists modules (cluster, worker_threads, vm, inspector, domain, repl, trace_events, wasi), APIs (fork, execPath, V8 flags, snapshots, native addons), and behaviors (OS signals, fs.watch, multi-context, QUIC) that cannot be supported due to sandbox architecture constraints, with explanations for each. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f8566d8 commit 99a97f4

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/nodejs-compatibility.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,42 @@ Unsupported modules use: `"<module> is not supported in sandbox"`.
7070
| `trace_events` | ⛔ Unsupported | `require()` fails immediately with deterministic unsupported-module error. |
7171
| `domain` | ⛔ Unsupported | `require()` fails immediately with deterministic unsupported-module error. |
7272

73+
## Permanently Unsupported Features
74+
75+
Some Node.js features cannot be supported in secure-exec due to fundamental architectural constraints of the sandboxed V8 isolate. These are not planned for implementation.
76+
77+
### Modules
78+
79+
| Module | Reason |
80+
| --- | --- |
81+
| `cluster` | Requires multi-process coordination with shared server handles and IPC. The sandbox runs a single V8 isolate — there is no process table to fork into. |
82+
| `worker_threads` | Requires spawning OS threads with separate V8 isolates and shared memory (`SharedArrayBuffer`). The sandbox architecture is single-isolate-per-session. |
83+
| `vm` | `vm.createContext()` and `vm.runInNewContext()` require creating isolated V8 contexts within the same isolate. The sandbox provides one context. `vm.runInThisContext()` works (equivalent to `eval`). |
84+
| `inspector` | Exposes the V8 debugger protocol (breakpoints, heap snapshots, CPU profiling). This is a security surface that allows arbitrary code introspection and cannot be exposed in a sandbox. |
85+
| `domain` | Deprecated since Node.js v4 and removed from documentation. Not worth implementing — use `async_hooks` or structured error handling instead. |
86+
| `repl` | Interactive read-eval-print loop requiring full terminal integration, tab completion, and command history. Not meaningful in a sandboxed execution context. |
87+
| `trace_events` | Requires V8 tracing infrastructure and file-based trace log output. Not available in the sandboxed isolate. |
88+
| `wasi` | WASI (WebAssembly System Interface) requires a separate WASM runtime within the V8 isolate. Not applicable — secure-exec IS the sandbox. |
89+
90+
### APIs
91+
92+
| API | Reason |
93+
| --- | --- |
94+
| `child_process.fork()` | Creates a new Node.js process with IPC channel. Requires a real `node` binary and multi-process architecture. `spawn`/`exec`/`execFile` ARE supported. |
95+
| `process.execPath` | Returns path to the Node.js binary. The sandbox has no `node` binary on disk — code runs in an embedded V8 isolate, not a Node.js process. |
96+
| V8 CLI flags (`--expose-gc`, `--expose-internals`, `--harmony-*`) | The V8 isolate is pre-configured at sandbox creation time. Runtime flag injection is a security risk. `--expose-gc` may be supported in the future as a bridge call. |
97+
| V8 snapshot APIs (`v8.writeHeapSnapshot`, `v8.startupSnapshot`) | Require direct V8 C++ API access for heap serialization. Not exposed through the bridge. |
98+
| Native addons (`.node` files) | Require loading compiled shared libraries (`.so`/`.dylib`/`.dll`) into the process. The sandbox does not permit native code execution. |
99+
100+
### Behaviors
101+
102+
| Behavior | Reason |
103+
| --- | --- |
104+
| Real OS signals (`SIGTERM`, `SIGUSR1`, etc.) | The sandbox is not an OS process — it's a V8 isolate within a host process. There are no real POSIX signals to deliver. `process.on('SIGINT')` may be emulated in the future. |
105+
| Real file system watchers (`fs.watch`) | The VFS (virtual file system) has no inotify/kqueue equivalent. `fs.watch()` returns a stub that never emits events. Writes to VFS do not trigger watcher notifications. |
106+
| Multi-context execution | The sandbox runs one V8 context per isolate. Features requiring context isolation (ShadowRealm, `vm.createContext`) cannot work. |
107+
| QUIC protocol | Experimental in Node.js, depends on `tls` + `net` + OpenSSL QUIC support. Not planned. |
108+
73109
## Tested Packages
74110

75111
The [project-matrix test suite](https://github.com/rivet-dev/secure-exec/tree/main/packages/secure-exec/tests/projects) validates that real-world npm packages produce identical output in secure-exec and host Node.js. Each fixture is a black-box Node project with no sandbox-specific code.

0 commit comments

Comments
 (0)