zerobox 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -496
- package/dist/platforms.test.js +4 -2
- package/dist/platforms.test.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,199 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
<img src="https://img.shields.io/github/license/afshinm/zerobox?style=for-the-badge&labelColor=000000" alt="Zerobox license" />
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://github.com/afshinm/zerobox/actions/workflows/ci.yml" target="_blank">
|
|
12
|
-
<img src="https://img.shields.io/github/actions/workflow/status/afshinm/zerobox/ci.yml?style=for-the-badge&labelColor=000000&label=CI" alt="Zerobox CI status" />
|
|
13
|
-
</a>
|
|
14
|
-
</p>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
Lightweight, cross-platform process sandboxing powered by [OpenAI Codex](https://github.com/openai/codex)'s sandbox runtime.
|
|
18
|
-
|
|
19
|
-
- **Deny by default:** Writes, network, and environment variables are blocked unless you allow them
|
|
20
|
-
- **Credential injection:** Pass API keys that the process never sees. Zerobox injects real values only for approved hosts
|
|
21
|
-
- **File access control:** Allow or deny reads and writes to specific paths
|
|
22
|
-
- **Network filtering:** Allow or deny outbound traffic by domain
|
|
23
|
-
- **Clean environment:** Only essential env vars (PATH, HOME, etc.) are inherited by default
|
|
24
|
-
- **Rust SDK:** `use zerobox::Sandbox` with a builder API
|
|
25
|
-
- **TypeScript SDK:** `import { Sandbox } from "zerobox"` with a Deno-style API
|
|
26
|
-
- **Cross-platform:** macOS and Linux. Windows support planned
|
|
27
|
-
- **Single binary:** No Docker, no VMs, ~10ms overhead
|
|
28
|
-
|
|
29
|
-
<p align="center">
|
|
30
|
-
<a href="https://www.youtube.com/watch?v=wZiPm9BOPCg" target="_blank" title="Watch the video">
|
|
31
|
-
<img alt="Zerobox Sandbox Flow" src="packages/zerobox/assets/flow.svg" alt="Watch the video" style="width: 100%; max-width: 1135px;" />
|
|
1
|
+
# Zerobox TypeScript SDK
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.npmjs.com/package/zerobox" target="_blank">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/zerobox?style=for-the-badge&labelColor=000000&label=npm" alt="Zerobox npm version" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/afshinm/zerobox/blob/main/LICENSE" target="_blank">
|
|
8
|
+
<img src="https://img.shields.io/github/license/afshinm/zerobox?style=for-the-badge&labelColor=000000" alt="Zerobox license" />
|
|
32
9
|
</a>
|
|
33
10
|
</p>
|
|
34
11
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Shell (macOS / Linux)
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
curl -fsSL https://raw.githubusercontent.com/afshinm/zerobox/main/install.sh | sh
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### npm
|
|
12
|
+
TypeScript / Node SDK for [zerobox](https://github.com/afshinm/zerobox). Sandbox any command with file, network, and credential controls.
|
|
44
13
|
|
|
45
14
|
```bash
|
|
46
|
-
npm install
|
|
15
|
+
npm install zerobox
|
|
47
16
|
```
|
|
48
17
|
|
|
49
|
-
|
|
18
|
+
Installing the package drops the `zerobox` CLI into your `node_modules/.bin/` and exposes a TypeScript SDK.
|
|
50
19
|
|
|
51
|
-
|
|
52
|
-
git clone https://github.com/afshinm/zerobox && cd zerobox
|
|
53
|
-
./scripts/sync.sh && cargo build --release -p zerobox
|
|
54
|
-
```
|
|
20
|
+
> For CLI usage, secrets concepts, the full flag reference, performance numbers, and platform support see the [main README](https://github.com/afshinm/zerobox).
|
|
55
21
|
|
|
56
22
|
## Quick start
|
|
57
23
|
|
|
58
|
-
Run a command with no writes and no network access:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
zerobox -- node -e "console.log('hello')"
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Allow writes to a specific directory:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
zerobox --allow-write=. -- node script.js
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Allow network to a specific domain:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
zerobox --allow-net=api.openai.com -- node agent.js
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Pass a secret to a specific host and the inner process never sees the real value:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
zerobox --secret OPENAI_API_KEY=sk-proj-123 --secret-host OPENAI_API_KEY=api.openai.com -- node agent.js
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Same thing with the Rust SDK:
|
|
83
|
-
|
|
84
|
-
```rust
|
|
85
|
-
use zerobox::Sandbox;
|
|
86
|
-
|
|
87
|
-
let output = Sandbox::command("node")
|
|
88
|
-
.arg("agent.js")
|
|
89
|
-
.secret("OPENAI_API_KEY", "sk-proj-123")
|
|
90
|
-
.secret_host("OPENAI_API_KEY", "api.openai.com")
|
|
91
|
-
.run()
|
|
92
|
-
.await?;
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Or the TypeScript SDK:
|
|
96
|
-
|
|
97
24
|
```ts
|
|
98
25
|
import { Sandbox } from "zerobox";
|
|
99
26
|
|
|
100
|
-
const sandbox = Sandbox.create({
|
|
101
|
-
|
|
102
|
-
OPENAI_API_KEY: {
|
|
103
|
-
value: process.env.OPENAI_API_KEY,
|
|
104
|
-
hosts: ["api.openai.com"],
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const output = await sandbox.sh`node agent.js`.text();
|
|
27
|
+
const sandbox = Sandbox.create({ allowWrite: ["/tmp"] });
|
|
28
|
+
const output = await sandbox.sh`echo hello`.text();
|
|
110
29
|
```
|
|
111
30
|
|
|
112
|
-
|
|
31
|
+
## Commands
|
|
113
32
|
|
|
114
|
-
|
|
115
|
-
zerobox --restore --allow-write=. -- npm install
|
|
116
|
-
```
|
|
33
|
+
The SDK exposes three ways to run a command. Each returns a `ShellCommand` you terminate with `.text()`, `.json()`, or `.output()`.
|
|
117
34
|
|
|
118
|
-
|
|
35
|
+
### Shell (tagged template)
|
|
119
36
|
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
zerobox snapshot diff <session-id>
|
|
124
|
-
zerobox snapshot restore <session-id>
|
|
37
|
+
```ts
|
|
38
|
+
const name = "world";
|
|
39
|
+
await sandbox.sh`echo hello ${name}`.text();
|
|
125
40
|
```
|
|
126
41
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<p align="center">
|
|
130
|
-
<img src="https://raw.githubusercontent.com/afshinm/zerobox/refs/heads/main/packages/zerobox/assets/sandbox-flow.png" alt="Zerobox architecture" width="800" />
|
|
131
|
-
</p>
|
|
132
|
-
|
|
133
|
-
## Secrets
|
|
134
|
-
|
|
135
|
-
Secrets are API keys, tokens, or credentials that should never be visible inside the sandbox. The sandboxed process sees a placeholder in the environment variable and the real value is substituted at the network proxy level only for requested hosts:
|
|
42
|
+
### Inline JavaScript
|
|
136
43
|
|
|
44
|
+
```ts
|
|
45
|
+
const data = await sandbox.js`
|
|
46
|
+
console.log(JSON.stringify({ sum: 1 + 2 }));
|
|
47
|
+
`.json<{ sum: number }>();
|
|
137
48
|
```
|
|
138
|
-
sandbox process: echo $OPENAI_API_KEY
|
|
139
|
-
-> ZEROBOX_SECRET_a1b2c3d4e5... (placeholder)
|
|
140
49
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
50
|
+
### Explicit command + args
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
await sandbox.exec("node", ["-e", "console.log('hi')"]).text();
|
|
144
54
|
```
|
|
145
55
|
|
|
146
|
-
|
|
56
|
+
## Results
|
|
147
57
|
|
|
148
|
-
|
|
58
|
+
| Method | On success | On non-zero exit |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `.text()` | Returns stdout as a string | Throws `SandboxCommandError` |
|
|
61
|
+
| `.json<T>()` | Parses stdout as JSON (typed) | Throws `SandboxCommandError` |
|
|
62
|
+
| `.output()` | Returns `{ code, stdout, stderr }` | Returns the same shape, never throws |
|
|
149
63
|
|
|
150
|
-
```
|
|
151
|
-
|
|
64
|
+
```ts
|
|
65
|
+
const data = await sandbox.sh`cat data.json`.json();
|
|
66
|
+
const result = await sandbox.sh`exit 42`.output();
|
|
67
|
+
// { code: 42, stdout: "", stderr: "" }
|
|
152
68
|
```
|
|
153
69
|
|
|
154
|
-
|
|
70
|
+
## Error handling
|
|
155
71
|
|
|
156
|
-
|
|
157
|
-
zerobox --secret TOKEN=abc123 -- node app.js
|
|
158
|
-
```
|
|
72
|
+
Non-zero exit codes throw `SandboxCommandError`:
|
|
159
73
|
|
|
160
|
-
|
|
74
|
+
```ts
|
|
75
|
+
import { Sandbox, SandboxCommandError } from "zerobox";
|
|
161
76
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
77
|
+
const sandbox = Sandbox.create();
|
|
78
|
+
try {
|
|
79
|
+
await sandbox.sh`exit 1`.text();
|
|
80
|
+
} catch (e) {
|
|
81
|
+
if (e instanceof SandboxCommandError) {
|
|
82
|
+
console.log(e.code);
|
|
83
|
+
console.log(e.stderr);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
167
86
|
```
|
|
168
87
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
### Rust SDK
|
|
172
|
-
|
|
173
|
-
```rust
|
|
174
|
-
let output = Sandbox::command("node")
|
|
175
|
-
.arg("agent.js")
|
|
176
|
-
.secret("OPENAI_API_KEY", "sk-proj-123")
|
|
177
|
-
.secret_host("OPENAI_API_KEY", "api.openai.com")
|
|
178
|
-
.secret("GITHUB_TOKEN", "ghp-456")
|
|
179
|
-
.secret_host("GITHUB_TOKEN", "api.github.com")
|
|
180
|
-
.run()
|
|
181
|
-
.await?;
|
|
182
|
-
```
|
|
88
|
+
## Secrets
|
|
183
89
|
|
|
184
|
-
|
|
90
|
+
Pass API keys that the sandboxed process never sees. The proxy substitutes the real value only for approved hosts.
|
|
185
91
|
|
|
186
92
|
```ts
|
|
187
|
-
import { Sandbox } from "zerobox";
|
|
188
|
-
|
|
189
93
|
const sandbox = Sandbox.create({
|
|
190
94
|
secrets: {
|
|
191
95
|
OPENAI_API_KEY: {
|
|
192
|
-
value: process.env.OPENAI_API_KEY
|
|
96
|
+
value: process.env.OPENAI_API_KEY!,
|
|
193
97
|
hosts: ["api.openai.com"],
|
|
194
98
|
},
|
|
195
99
|
GITHUB_TOKEN: {
|
|
196
|
-
value: process.env.GITHUB_TOKEN
|
|
100
|
+
value: process.env.GITHUB_TOKEN!,
|
|
197
101
|
hosts: ["api.github.com"],
|
|
198
102
|
},
|
|
199
103
|
},
|
|
@@ -202,382 +106,87 @@ const sandbox = Sandbox.create({
|
|
|
202
106
|
await sandbox.sh`node agent.js`.text();
|
|
203
107
|
```
|
|
204
108
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
By default, only essential variables are passed to the sandbox e.g. `PATH`, `HOME`, `USER`, `SHELL`, `TERM`, `LANG`.
|
|
109
|
+
See the [main README](https://github.com/afshinm/zerobox#secrets) for how placeholder substitution works.
|
|
208
110
|
|
|
209
|
-
|
|
111
|
+
## Snapshots
|
|
210
112
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
zerobox --allow-env -- node app.js
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Inherit specific env vars only
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
zerobox --allow-env=PATH,HOME,DATABASE_URL -- node app.js
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Block specific env vars
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
zerobox --allow-env --deny-env=AWS_SECRET_ACCESS_KEY -- node app.js
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
or set a specific variable:
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
zerobox --env NODE_ENV=production --env DEBUG=false -- node app.js
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Rust SDK
|
|
236
|
-
|
|
237
|
-
```rust
|
|
238
|
-
let output = Sandbox::command("node")
|
|
239
|
-
.arg("app.js")
|
|
240
|
-
.env("NODE_ENV", "production")
|
|
241
|
-
.allow_env(&["PATH", "HOME"])
|
|
242
|
-
.deny_env(&["AWS_SECRET_ACCESS_KEY"])
|
|
243
|
-
.run()
|
|
244
|
-
.await?;
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### TypeScript SDK
|
|
113
|
+
Record filesystem changes and roll them back automatically:
|
|
248
114
|
|
|
249
115
|
```ts
|
|
250
116
|
const sandbox = Sandbox.create({
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
denyEnv: ["AWS_SECRET_ACCESS_KEY"],
|
|
117
|
+
allowWrite: ["."],
|
|
118
|
+
restore: true,
|
|
254
119
|
});
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Examples
|
|
258
|
-
|
|
259
|
-
### Run AI-generated code safely
|
|
260
|
-
|
|
261
|
-
Run AI generated code without risking file corruption or data leaks:
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
zerobox -- python3 /tmp/task.py
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
Or allow writes only to an output directory:
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
zerobox --allow-write=/tmp/output -- python3 /tmp/task.py
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
Or via the Rust SDK:
|
|
274
|
-
|
|
275
|
-
```rust
|
|
276
|
-
let output = Sandbox::command("python3")
|
|
277
|
-
.arg("/tmp/task.py")
|
|
278
|
-
.allow_write("/tmp/output")
|
|
279
|
-
.allow_net(&["api.openai.com"])
|
|
280
|
-
.run()
|
|
281
|
-
.await?;
|
|
282
120
|
|
|
283
|
-
|
|
121
|
+
await sandbox.sh`npm install`.text();
|
|
284
122
|
```
|
|
285
123
|
|
|
286
|
-
|
|
124
|
+
Record without rolling back:
|
|
287
125
|
|
|
288
126
|
```ts
|
|
289
|
-
import { Sandbox } from "zerobox";
|
|
290
|
-
|
|
291
127
|
const sandbox = Sandbox.create({
|
|
292
|
-
allowWrite: ["
|
|
293
|
-
|
|
128
|
+
allowWrite: ["."],
|
|
129
|
+
snapshot: true,
|
|
130
|
+
snapshotExclude: ["node_modules"],
|
|
294
131
|
});
|
|
295
132
|
|
|
296
|
-
|
|
297
|
-
console.log(result.code, result.stdout);
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Restrict LLM tool calls
|
|
301
|
-
|
|
302
|
-
Each AI tool call can also be sandboxed individually. The parent agent process runs normally and only some operations are sandboxed:
|
|
303
|
-
|
|
304
|
-
```ts
|
|
305
|
-
import { Sandbox } from "zerobox";
|
|
306
|
-
|
|
307
|
-
const reader = Sandbox.create();
|
|
308
|
-
const writer = Sandbox.create({ allowWrite: ["/tmp"] });
|
|
309
|
-
const fetcher = Sandbox.create({ allowNet: ["example.com"] });
|
|
310
|
-
|
|
311
|
-
const data = await reader.js`
|
|
312
|
-
const content = require("fs").readFileSync("/tmp/input.txt", "utf8");
|
|
313
|
-
console.log(JSON.stringify({ content }));
|
|
314
|
-
`.json();
|
|
315
|
-
|
|
316
|
-
await writer.js`
|
|
317
|
-
require("fs").writeFileSync("/tmp/output.txt", "result");
|
|
318
|
-
console.log("ok");
|
|
319
|
-
`.text();
|
|
320
|
-
|
|
321
|
-
const result = await fetcher.js`
|
|
322
|
-
const res = await fetch("https://example.com");
|
|
323
|
-
console.log(JSON.stringify({ status: res.status }));
|
|
324
|
-
`.json();
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Full working examples:
|
|
328
|
-
|
|
329
|
-
- [`examples/ai-agent-sandboxed`](examples/ai-agent-sandboxed) - Entire agent process sandboxed with secrets (API key never visible)
|
|
330
|
-
- [`examples/ai-agent`](examples/ai-agent) - Vercel AI SDK with per-tool sandboxing and secrets
|
|
331
|
-
- [`examples/workflow`](examples/workflow) - [Vercel Workflow](https://useworkflow.dev/) with sandboxed durable steps
|
|
332
|
-
|
|
333
|
-
### Protect your repo during builds
|
|
334
|
-
|
|
335
|
-
Run a build script with network access:
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
zerobox --allow-write=./dist --allow-net -- npm run build
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
Run tests with no network and catch accidental external calls:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
zerobox --allow-write=/tmp -- npm test
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
## Rust SDK
|
|
348
|
-
|
|
349
|
-
```toml
|
|
350
|
-
[dependencies]
|
|
351
|
-
zerobox = "0.1"
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
### Run and collect output
|
|
355
|
-
|
|
356
|
-
```rust
|
|
357
|
-
use zerobox::Sandbox;
|
|
358
|
-
|
|
359
|
-
let output = Sandbox::command("echo")
|
|
360
|
-
.arg("hello")
|
|
361
|
-
.allow_write("/tmp")
|
|
362
|
-
.run()
|
|
363
|
-
.await?;
|
|
364
|
-
|
|
365
|
-
println!("{}", String::from_utf8_lossy(&output.stdout));
|
|
366
|
-
println!("exit: {}", output.status);
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### Stream output
|
|
370
|
-
|
|
371
|
-
```rust
|
|
372
|
-
let mut child = Sandbox::command("cargo")
|
|
373
|
-
.arg("build")
|
|
374
|
-
.allow_write("/project/target")
|
|
375
|
-
.allow_net(&["crates.io"])
|
|
376
|
-
.spawn()
|
|
377
|
-
.await?;
|
|
378
|
-
|
|
379
|
-
let stdout = child.stdout().unwrap();
|
|
380
|
-
// read from stdout while the process runs
|
|
381
|
-
let status = child.wait().await?;
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Inherit stdio (TTY passthrough)
|
|
385
|
-
|
|
386
|
-
```rust
|
|
387
|
-
let status = Sandbox::command("vim")
|
|
388
|
-
.allow_write("/project")
|
|
389
|
-
.status()
|
|
390
|
-
.await?;
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
### Profiles
|
|
394
|
-
|
|
395
|
-
```rust
|
|
396
|
-
// default profile loads automatically (denies ~/.ssh, ~/.aws, etc.)
|
|
397
|
-
let output = Sandbox::command("npm test").run().await?;
|
|
398
|
-
|
|
399
|
-
// use a different profile
|
|
400
|
-
let output = Sandbox::command("npm test")
|
|
401
|
-
.profile("workspace")
|
|
402
|
-
.run()
|
|
403
|
-
.await?;
|
|
404
|
-
|
|
405
|
-
// combine multiple profiles (merged left-to-right)
|
|
406
|
-
let output = Sandbox::command("claude")
|
|
407
|
-
.profiles(&["claude", "git-config"])
|
|
408
|
-
.run()
|
|
409
|
-
.await?;
|
|
410
|
-
|
|
411
|
-
// opt out of profiles
|
|
412
|
-
let output = Sandbox::command("npm test")
|
|
413
|
-
.no_profile()
|
|
414
|
-
.allow_read("/src")
|
|
415
|
-
.run()
|
|
416
|
-
.await?;
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
### Full access / no sandbox
|
|
420
|
-
|
|
421
|
-
```rust
|
|
422
|
-
let output = Sandbox::command("install.sh")
|
|
423
|
-
.full_access()
|
|
424
|
-
.run()
|
|
425
|
-
.await?;
|
|
426
|
-
|
|
427
|
-
let output = Sandbox::command("ls")
|
|
428
|
-
.no_sandbox()
|
|
429
|
-
.run()
|
|
430
|
-
.await?;
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
## TypeScript SDK
|
|
434
|
-
|
|
435
|
-
```bash
|
|
436
|
-
npm install zerobox
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### Shell commands
|
|
440
|
-
|
|
441
|
-
```ts
|
|
442
|
-
import { Sandbox } from "zerobox";
|
|
443
|
-
|
|
444
|
-
const sandbox = Sandbox.create({ allowWrite: ["/tmp"] });
|
|
445
|
-
const output = await sandbox.sh`echo hello`.text();
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### JSON output
|
|
449
|
-
|
|
450
|
-
```ts
|
|
451
|
-
const data = await sandbox.sh`cat data.json`.json();
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### Raw output (doesn't throw on non-zero exit)
|
|
455
|
-
|
|
456
|
-
```ts
|
|
457
|
-
const result = await sandbox.sh`exit 42`.output();
|
|
458
|
-
// { code: 42, stdout: "", stderr: "" }
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### Explicit command + args
|
|
462
|
-
|
|
463
|
-
```ts
|
|
464
|
-
await sandbox.exec("node", ["-e", "console.log('hi')"]).text();
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### Inline JavaScript
|
|
468
|
-
|
|
469
|
-
```ts
|
|
470
|
-
const data = await sandbox.js`
|
|
471
|
-
console.log(JSON.stringify({ sum: 1 + 2 }));
|
|
472
|
-
`.json();
|
|
133
|
+
await sandbox.sh`npm install`.text();
|
|
473
134
|
```
|
|
474
135
|
|
|
475
|
-
|
|
136
|
+
## Cancellation
|
|
476
137
|
|
|
477
|
-
|
|
138
|
+
Pass an `AbortSignal` to any terminator:
|
|
478
139
|
|
|
479
140
|
```ts
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
try {
|
|
484
|
-
await sandbox.sh`exit 1`.text();
|
|
485
|
-
} catch (e) {
|
|
486
|
-
if (e instanceof SandboxCommandError) {
|
|
487
|
-
console.log(e.code); // 1
|
|
488
|
-
console.log(e.stderr);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
141
|
+
const controller = new AbortController();
|
|
142
|
+
setTimeout(() => controller.abort(), 1000);
|
|
143
|
+
await sandbox.sh`sleep 60`.text({ signal: controller.signal });
|
|
491
144
|
```
|
|
492
145
|
|
|
493
|
-
|
|
146
|
+
## Environment variables
|
|
494
147
|
|
|
495
148
|
```ts
|
|
496
149
|
const sandbox = Sandbox.create({
|
|
497
|
-
|
|
498
|
-
|
|
150
|
+
env: { NODE_ENV: "production" },
|
|
151
|
+
allowEnv: ["PATH", "HOME"],
|
|
152
|
+
denyEnv: ["AWS_SECRET_ACCESS_KEY"],
|
|
499
153
|
});
|
|
500
|
-
|
|
501
|
-
// Changes are automatically undone after execution.
|
|
502
|
-
await sandbox.sh`npm install`.text();
|
|
503
154
|
```
|
|
504
155
|
|
|
505
|
-
|
|
156
|
+
See the [main README](https://github.com/afshinm/zerobox#environment-variables) for what's inherited by default and the CLI equivalents.
|
|
506
157
|
|
|
507
|
-
|
|
508
|
-
const sandbox = Sandbox.create({
|
|
509
|
-
allowWrite: ["."],
|
|
510
|
-
snapshot: true,
|
|
511
|
-
snapshotExclude: ["node_modules"],
|
|
512
|
-
});
|
|
158
|
+
## Options
|
|
513
159
|
|
|
514
|
-
|
|
515
|
-
```
|
|
160
|
+
`Sandbox.create(options)` accepts a `SandboxOptions` object. All fields are optional.
|
|
516
161
|
|
|
517
|
-
|
|
162
|
+
| Field | Type | Description |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| `profile` | `string \| string[]` | Named profile(s). A list merges left-to-right. Default `"workspace"`. |
|
|
165
|
+
| `allowRead` / `denyRead` | `string[]` | Readable / blocked paths. |
|
|
166
|
+
| `allowWrite` / `denyWrite` | `string[]` | Writable / blocked paths. |
|
|
167
|
+
| `allowNet` | `boolean \| string[]` | `true` allows all. A list restricts to those domains. |
|
|
168
|
+
| `denyNet` | `string[]` | Blocked domains. |
|
|
169
|
+
| `allowAll` | `boolean` | Full filesystem + network access. |
|
|
170
|
+
| `noSandbox` | `boolean` | Disable the sandbox entirely. |
|
|
171
|
+
| `strictSandbox` | `boolean` | Fail instead of falling back to weaker isolation. |
|
|
172
|
+
| `cwd` | `string` | Working directory. |
|
|
173
|
+
| `env` | `Record<string, string>` | Explicit env vars. |
|
|
174
|
+
| `allowEnv` | `boolean \| string[]` | Inherit parent env vars. |
|
|
175
|
+
| `denyEnv` | `string[]` | Blocked env vars. |
|
|
176
|
+
| `snapshot` | `boolean` | Record filesystem changes. |
|
|
177
|
+
| `restore` | `boolean` | Record and roll back after exit. Implies `snapshot`. |
|
|
178
|
+
| `snapshotPaths` / `snapshotExclude` | `string[]` | Tracked paths / excluded patterns. |
|
|
179
|
+
| `secrets` | `Record<string, SecretConfig>` | Secrets with per-host scopes. |
|
|
180
|
+
| `debug` | `boolean` | Print sandbox config to stderr. |
|
|
518
181
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
182
|
+
## Caveats
|
|
183
|
+
|
|
184
|
+
Node.js `fetch` does not respect `HTTPS_PROXY` by default. When running Node inside a sandbox with secrets, pass `--use-env-proxy` to the sandboxed command.
|
|
185
|
+
|
|
186
|
+
## Other SDKs
|
|
523
187
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
Sandbox overhead is minimal, typically ~10ms and ~7MB:
|
|
527
|
-
|
|
528
|
-
| Command | Bare | Sandboxed | Overhead | Bare Mem | Sandbox Mem |
|
|
529
|
-
| ------------------ | ---- | --------- | -------- | -------- | ----------- |
|
|
530
|
-
| `echo hello` | <1ms | 10ms | +10ms | 1.2 MB | 8.4 MB |
|
|
531
|
-
| `node -e '...'` | 10ms | 20ms | +10ms | 39.3 MB | 39.1 MB |
|
|
532
|
-
| `python3 -c '...'` | 10ms | 20ms | +10ms | 12.9 MB | 13.0 MB |
|
|
533
|
-
| `cat 10MB file` | <1ms | 10ms | +10ms | 1.9 MB | 8.4 MB |
|
|
534
|
-
| `curl https://...` | 50ms | 60ms | +10ms | 7.2 MB | 8.4 MB |
|
|
535
|
-
|
|
536
|
-
<sub>Best of 10 runs with warmup on Apple M5 Pro. Run `./bench/run.sh` to reproduce.</sub>
|
|
537
|
-
|
|
538
|
-
## Platform support
|
|
539
|
-
|
|
540
|
-
| Platform | Backend | Status |
|
|
541
|
-
| -------- | ----------------------------------- | --------------- |
|
|
542
|
-
| macOS | Seatbelt (`sandbox-exec`) | Fully supported |
|
|
543
|
-
| Linux | Bubblewrap + Seccomp + Namespaces | Fully supported |
|
|
544
|
-
| Windows | Restricted Tokens + ACLs + Firewall | Planned |
|
|
545
|
-
|
|
546
|
-
## CLI reference
|
|
547
|
-
|
|
548
|
-
| Flag | Example | Description |
|
|
549
|
-
| ------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
550
|
-
| `--allow-read <paths>` | `--allow-read=/tmp,/data` | Restrict readable user data to listed paths. System libraries remain accessible. Default: all reads allowed. |
|
|
551
|
-
| `--deny-read <paths>` | `--deny-read=/secret` | Block reading from these paths. Takes precedence over `--allow-read`. |
|
|
552
|
-
| `--allow-write [paths]` | `--allow-write=.` | Allow writing to these paths. Without a value, allows writing everywhere. Default: no writes. |
|
|
553
|
-
| `--deny-write <paths>` | `--deny-write=./.git` | Block writing to these paths. Takes precedence over `--allow-write`. |
|
|
554
|
-
| `--allow-net [domains]` | `--allow-net=example.com` | Allow outbound network. Without a value, allows all domains. Default: no network. |
|
|
555
|
-
| `--deny-net <domains>` | `--deny-net=evil.com` | Block network to these domains. Takes precedence over `--allow-net`. |
|
|
556
|
-
| `--env <KEY=VALUE>` | `--env NODE_ENV=prod` | Set env var in the sandbox. Can be repeated. |
|
|
557
|
-
| `--allow-env [keys]` | `--allow-env=PATH,HOME` | Inherit parent env vars. Without a value, inherits all. Default: only PATH, HOME, USER, SHELL, TERM, LANG. |
|
|
558
|
-
| `--deny-env <keys>` | `--deny-env=SECRET` | Drop these parent env vars. Takes precedence over `--allow-env`. |
|
|
559
|
-
| `--secret <KEY=VALUE>` | `--secret API_KEY=sk-123` | Pass a secret. The process sees a placeholder; the real value is injected at the proxy for approved hosts. |
|
|
560
|
-
| `--secret-host <KEY=HOSTS>` | `--secret-host API_KEY=api.openai.com` | Restrict a secret to specific hosts. Without this, the secret is substituted for all hosts. |
|
|
561
|
-
| `-A`, `--allow-all` | `-A` | Grant all filesystem and network permissions. Env and secrets still apply. |
|
|
562
|
-
| `--no-sandbox` | `--no-sandbox` | Disable the sandbox entirely. |
|
|
563
|
-
| `--strict-sandbox` | `--strict-sandbox` | Require full sandbox (bubblewrap). Fail instead of falling back to weaker isolation. |
|
|
564
|
-
| `--debug` | `--debug` | Print sandbox config and proxy decisions to stderr. |
|
|
565
|
-
| `--snapshot` | `--snapshot` | Record filesystem changes during execution. |
|
|
566
|
-
| `--restore` | `--restore` | Record and restore tracked files to pre-execution state after exit. Implies `--snapshot`. |
|
|
567
|
-
| `--snapshot-path <paths>` | `--snapshot-path=./src` | Paths to track for snapshots (default: cwd). |
|
|
568
|
-
| `--snapshot-exclude <patterns>` | `--snapshot-exclude=build` | Exclude patterns from snapshots. |
|
|
569
|
-
| `-C <dir>` | `-C /workspace` | Set working directory for the sandboxed command. |
|
|
570
|
-
| `-V`, `--version` | `--version` | Print version. |
|
|
571
|
-
| `-h`, `--help` | `--help` | Print help. |
|
|
572
|
-
|
|
573
|
-
### Snapshot subcommands
|
|
574
|
-
|
|
575
|
-
| Command | Description |
|
|
576
|
-
| -------------------------------------------- | ------------------------------------------- |
|
|
577
|
-
| `zerobox snapshot list` | List recorded sessions. |
|
|
578
|
-
| `zerobox snapshot diff <id>` | Show changes from a session. |
|
|
579
|
-
| `zerobox snapshot restore <id>` | Restore filesystem to a session's baseline. |
|
|
580
|
-
| `zerobox snapshot clean --older-than=<days>` | Remove old snapshot sessions. |
|
|
188
|
+
- [Python SDK](https://github.com/afshinm/zerobox/tree/main/sdks/python) (PyPI: `zerobox`)
|
|
189
|
+
- [Rust SDK](https://github.com/afshinm/zerobox/tree/main/crates/zerobox) (crates.io: `zerobox`)
|
|
581
190
|
|
|
582
191
|
## License
|
|
583
192
|
|
package/dist/platforms.test.js
CHANGED
|
@@ -132,8 +132,10 @@ describe("platformPackage", () => {
|
|
|
132
132
|
it("returns undefined for unsupported arch", () => {
|
|
133
133
|
expect(platformPackage(makeEnv({ platform: "darwin", arch: "s390x" }))).toBeUndefined();
|
|
134
134
|
});
|
|
135
|
-
it("
|
|
136
|
-
//
|
|
135
|
+
it("returns undefined when musl is detected but arch is unsupported", () => {
|
|
136
|
+
// Exercises the musl → glibc fallback (`MUSL_PLATFORMS[key] ?? GLIBC_PLATFORMS[key]`).
|
|
137
|
+
// With today's dicts the fallback can never produce a value because no linux
|
|
138
|
+
// arch is glibc-only, but this guards the branch if they ever diverge.
|
|
137
139
|
expect(platformPackage(makeEnv({
|
|
138
140
|
arch: "s390x",
|
|
139
141
|
linkerExists: () => true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platforms.test.js","sourceRoot":"","sources":["../src/platforms.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAoB,MAAM,gBAAgB,CAAC;AAE/E,SAAS,OAAO,CAAC,YAAkC,EAAE;IACnD,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;QACX,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;QACzB,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;QAC7B,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;QAC1B,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;QAC1B,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAA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,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,2BAA2B;SACvD,CAAC,CACH,CACF,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,uFAAuF;QACvF,6EAA6E;QAC7E,uEAAuE;QACvE,MAAM,CACJ,eAAe,CACb,OAAO,CAAC;YACN,IAAI,EAAE,OAAO;YACb,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;SACzB,CAAC,CACH,CACF,CAAC,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zerobox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Sandbox any command with file, network, and credential controls.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"dist/"
|
|
41
41
|
],
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@zerobox/cli-darwin-
|
|
44
|
-
"@zerobox/cli-
|
|
45
|
-
"@zerobox/cli-linux-
|
|
46
|
-
"@zerobox/cli-linux-
|
|
47
|
-
"@zerobox/cli-
|
|
48
|
-
"@zerobox/cli-linux-x64-musl": "0.
|
|
43
|
+
"@zerobox/cli-darwin-arm64": "0.3.0",
|
|
44
|
+
"@zerobox/cli-darwin-x64": "0.3.0",
|
|
45
|
+
"@zerobox/cli-linux-arm64": "0.3.0",
|
|
46
|
+
"@zerobox/cli-linux-x64": "0.3.0",
|
|
47
|
+
"@zerobox/cli-linux-arm64-musl": "0.3.0",
|
|
48
|
+
"@zerobox/cli-linux-x64-musl": "0.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.0.0",
|