Skip to content

Commit 603d05f

Browse files
Version Packages (#63)
1 parent 4bedc3a commit 603d05f

File tree

8 files changed

+70
-68
lines changed

8 files changed

+70
-68
lines changed

.changeset/env-isolation-security.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

.changeset/fair-impalas-agree.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/basic/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This image is unique to this repo, and you'll never need it.
22
# Whenever you're integrating with sandbox SDK in your own project,
33
# you should use the official image instead:
4-
# FROM docker.io/cloudflare/sandbox:0.2.4
5-
FROM cloudflare/sandbox-test:0.2.4
4+
# FROM docker.io/cloudflare/sandbox:0.3.0
5+
FROM cloudflare/sandbox-test:0.3.0
66

77
# On a mac, you might need to actively pick up the
88
# arm64 build of the image.

examples/code-interpreter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"wrangler": "^4.27.0"
1818
},
1919
"dependencies": {
20-
"@cloudflare/sandbox": "^0.2.4",
20+
"@cloudflare/sandbox": "^0.3.0",
2121
"openai": "^5.12.0"
2222
}
2323
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sandbox/CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,68 @@
11
# @cloudflare/sandbox
22

3+
## 0.3.0
4+
5+
### Minor Changes
6+
7+
- [#59](https://github.com/cloudflare/sandbox-sdk/pull/59) [`b6757f7`](https://github.com/cloudflare/sandbox-sdk/commit/b6757f730c34381d5a70d513944bbf9840f598ab) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Add process isolation for sandbox commands
8+
9+
Implements PID namespace isolation to protect control plane processes (Jupyter, Bun) from sandboxed code. Commands executed via `exec()` now run in isolated namespaces that cannot see or interact with system processes.
10+
11+
**Key security improvements:**
12+
13+
- Control plane processes are hidden from sandboxed commands
14+
- Platform secrets in `/proc/1/environ` are inaccessible
15+
- Ports 8888 (Jupyter) and 3000 (Bun) are protected from hijacking
16+
17+
**Breaking changes:**
18+
19+
1. **Removed `sessionId` parameter**: The `sessionId` parameter has been removed from all methods (`exec()`, `execStream()`, `startProcess()`, etc.). Each sandbox now maintains its own persistent session automatically.
20+
21+
```javascript
22+
// Before: manual session management
23+
await sandbox.exec("cd /app", { sessionId: "my-session" });
24+
25+
// After: automatic session per sandbox
26+
await sandbox.exec("cd /app");
27+
```
28+
29+
2. **Commands now maintain state**: Commands within the same sandbox now share state (working directory, environment variables, background processes). Previously each command was stateless.
30+
31+
```javascript
32+
// Before: each exec was independent
33+
await sandbox.exec("cd /app");
34+
await sandbox.exec("pwd"); // Output: /workspace
35+
36+
// After: state persists in session
37+
await sandbox.exec("cd /app");
38+
await sandbox.exec("pwd"); // Output: /app
39+
```
40+
41+
**Migration guide:**
42+
43+
- Remove `sessionId` from all method calls - each sandbox maintains its own session
44+
- If you need isolated execution contexts within the same sandbox, use `sandbox.createSession()`:
45+
```javascript
46+
// Create independent sessions with different environments
47+
const buildSession = await sandbox.createSession({
48+
name: "build",
49+
env: { NODE_ENV: "production" },
50+
cwd: "/build",
51+
});
52+
const testSession = await sandbox.createSession({
53+
name: "test",
54+
env: { NODE_ENV: "test" },
55+
cwd: "/test",
56+
});
57+
```
58+
- Environment variables set in one command persist to the next
59+
- Background processes remain active until explicitly killed
60+
- Requires CAP_SYS_ADMIN (available in production, falls back gracefully in dev)
61+
62+
### Patch Changes
63+
64+
- [#62](https://github.com/cloudflare/sandbox-sdk/pull/62) [`4bedc3a`](https://github.com/cloudflare/sandbox-sdk/commit/4bedc3aba347f3d4090a6efe2c9778bac00ce74a) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Fix broken build due to bun lockfile not being used
65+
366
## 0.2.4
467

568
### Patch Changes

packages/sandbox/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ npm install @cloudflare/sandbox
7272
1. **Create a Dockerfile** (temporary requirement, will be removed in future releases):
7373

7474
```dockerfile
75-
FROM docker.io/cloudflare/sandbox:0.2.4
75+
FROM docker.io/cloudflare/sandbox:0.3.0
7676

7777
# Expose the ports you want to expose
7878
EXPOSE 3000

packages/sandbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflare/sandbox",
3-
"version": "0.2.4",
3+
"version": "0.3.0",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/cloudflare/sandbox-sdk"

0 commit comments

Comments
 (0)