-
Notifications
You must be signed in to change notification settings - Fork 1
Sandbox
Edge adaptation of the upstream process sandbox and file-effect policy system.
Upstream reference: Sandbox
The sandbox subsystem wraps subprocess arguments in file-effect policies. It operates at three layers:
-
dsh-sandbox — abstract seam defining
ctx.sandbox.confine(argv, policy)and the escalation vocabulary. Three file-effect modes: read-only, workspace-write, danger-full-access. - dsh-sandbox-local — platform-specific implementations: Linux bwrap/Landlock, macOS Seatbelt, Windows ACL tokens.
-
Consumers —
dsh-bash-sandboxanddsh-pwsh-sandboxwrap shell commands through the sandbox before execution.
The sandbox also provides canonicalPath() (resolves symlinks via node:fs.realpathSync) and writableRoots() (computes allowed write directories including os.tmpdir()).
The dsh-sandbox package imports node:fs (realpathSync) and node:os (tmpdir), which are unavailable in Cloudflare Workers. Edge applies a version-bound patch that makes two changes:
-
canonicalPath(path)— returns the path directly instead of callingrealpathSync.native(). VFS has no symlinks, so resolution is identity. -
writableRoots(policy)— omits thetmpdir()call. The writable roots are the workspace root and/tmponly.
Edge does not install the ctx.sandbox service or any sandbox backend (dsh-sandbox-local). The patch is applied so that other upstream packages that import from dsh-sandbox (like the filesystem layer) can load without crashing on node:fs / node:os imports.
EdgeFileSystem reports sandboxMode as undefined, indicating no sandbox enforcement. The Cloudflare Workers isolate provides its own security boundary — code runs in a V8 isolate with no filesystem access beyond the Computer VFS, which is workspace-scoped by construction.
- The sandbox escalation vocabulary and approval choreography
- The
SandboxPolicyresolution chain - The
ConfinedArgvresult classification (denial signatures, runner failure rules)
| Aspect | Upstream (Node.js) | Edge (Workers) |
|---|---|---|
| Process isolation | bwrap/Landlock/Seatbelt/ACL per command | V8 isolate — no native processes |
| Filesystem scope | File-effect policy per subprocess | VFS workspace-scoped by construction |
| Write restriction | Configurable per-command via sandbox modes | All writes go through VFS — workspace only |
| Symlink resolution | realpathSync.native() |
Identity — VFS has no symlinks |
| Component | Category | Edge Code |
|---|---|---|
| dsh-sandbox seam | Patched | Remove node:fs/node:os imports (6-line patch) |
| Sandbox service | Not installed | V8 isolate + VFS provide equivalent boundary |
| EdgeFileSystem.sandboxMode | Override | Returns undefined — no process-level sandbox |
Key observation: The upstream sandbox exists to confine native subprocesses. Edge has no native subprocesses — just-bash runs in-process, and VFS is workspace-scoped by construction. The patch exists solely to prevent node:fs/node:os import crashes, not to provide sandbox functionality. If Cloudflare Containers are adopted for real subprocess execution, the sandbox seam would need a Container-aware backend instead of the current no-op.
Evaluate Container-aware sandbox backend. If subprocess support via Cloudflare Containers is implemented (#98), the sandbox seam should be wired with a Container-level confinement backend rather than remaining a no-op. The upstream ctx.sandbox.confine() API would apply file-effect policies to Container-spawned processes.
- Home
- Architecture
- Core & Scope
- Session & Persistence
- Model & Context
-
Execution & Tools
- Tools
- Bash
- Subprocess 🚫
- PTY Session 🚫
- Background Jobs 🚫
- Filesystem
- LSP Navigation 🚫
- Code Runtime 🚫
-
Web Access
⚠️ -
Skills
⚠️ - Workflow 🚫
- Subagent 🚫
-
Policy & Interaction
- Goal
- Approval 🚫
- Permission Presets 🚫
-
Sandbox
⚠️ - Plan Mode 🚫
- User Interaction 🚫
- Commands 🚫
- Schedule 🚫
- Message Feedback 🚫
- Platform & Access
- Development
- 首页
- 架构
- 核心与作用域
- 会话与持久化
- 模型与上下文
- 执行与工具
- 策略与交互
- 平台与接入
- 开发