跳转到正文
报告库
用途分类 / 其他用途

Sandbox Stable Skill 安全审计

作者说它能做什么(原文)

Build or maintain Cloudflare Sandbox apps on the stable @cloudflare/sandbox package. Use sandbox-next for preview apps and sandbox-migrate-to-next for stable-to-preview migrations.

第三方安全检查结论

发现安全风险

已检查文件
1
发现的风险
1
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

字符串命令接口在接收不可信输入时可能造成 sandbox 内命令注入

原文依据:2 处
发现了什么

该 Skill 将 `sandbox.exec(command)` 定义为执行完整命令字符串,并展示了 shell 风格命令,但没有同时要求隔离、拒绝或安全编码用户可控参数。

为什么需要注意

如果使用者生成的代码把请求参数、聊天内容、文件名或其他不可信文本拼入命令字符串,攻击者可能在隔离容器内执行额外命令,读取或修改其中的文件,并利用该容器获准的网络访问。现有证据不表明命令会逃逸到宿主机。

这段证据能说明什么

源码确认 `exec` 接收命令字符串,并给出一个固定字符串示例;但没有指示把用户输入拼接进命令,也没有展示任何不可信数据流。因此,仅凭该接口形式不足以认定存在命令注入风险。只有应用后来将未验证的用户输入插入该字符串时,攻击者才可能在 sandbox 内执行额外命令。用户可要求作者说明所有命令参数的来源,并限制为固定命令或经过严格校验的参数。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:37来自说明文档打开原文件
- `await sandbox.exec(command)` takes a **command string** and resolves when the command **finishes**, with buffered `stdout` / `stderr` / `exitCode` (and related fields).- Long-running and streaming work use the **stable** command APIs (`startProcess`, `execStream`, and related helpers)—not the `@next` single-handle model. Open the Commands docs; do not invent `@next` `output()` handles on stable.- **Sessions** can preserve working directory and environment across commands (default session / `enableDefaultSession`, `createSession`). See Sessions docs when state must carry across calls.
查看另外 1 个位置
SKILL.md:55来自说明文档打开原文件
const sandbox = getSandbox(env.Sandbox, "user-123");const result = await sandbox.exec('python3 -c "print(2 + 2)"');// result.stdout, result.exitCode, result.success```
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

4 个说明模块

该 Skill 是 Cloudflare Sandbox 稳定版的开发指引与文档索引,要求先核对 Worker 依赖和容器镜像是否都属于稳定版;发现预览版或迁移需求时停止并切换到对应 Skill。

查看原文
SKILL.md:22来自说明文档打开原文件
| ----- | ---------- || npm dependency | Default `@cloudflare/sandbox` (**not** `@next` / preview tags) || Container image | Matching **stable** image (not `cloudflare/sandbox:next`) || If you find… | Action || ------------ | ------ || `@cloudflare/sandbox@next` or a `next` image | **Stop.** Load **`sandbox-next`**. || User wants to port to 1.0 / `@next` | **Stop.** Load **`sandbox-migrate-to-next`**. Do not half-apply preview APIs on a stable package. || Only cleaning deprecated stable APIs | Stay here; use the [2026 deprecation guide](https://developers.cloudflare.com/sandbox/guides/2026-deprecation/). That is **not** a move to `@next`. |
SKILL.md:31来自说明文档打开原文件
Never mix a stable Worker package with an `@next` container image (or the reverse).

该 Skill 指导应用从 Cloudflare Worker 驱动隔离的 Linux 环境,并提供命令执行、进程、文件、挂载、端口、隧道、备份和解释器等能力的文档入口。

查看原文
SKILL.md:8来自说明文档打开原文件
Isolated Linux environments on [Cloudflare Containers](https://developers.cloudflare.com/containers/), driven from Workers.
SKILL.md:37来自说明文档打开原文件
- `await sandbox.exec(command)` takes a **command string** and resolves when the command **finishes**, with buffered `stdout` / `stderr` / `exitCode` (and related fields).- Long-running and streaming work use the **stable** command APIs (`startProcess`, `execStream`, and related helpers)—not the `@next` single-handle model. Open the Commands docs; do not invent `@next` `output()` handles on stable.- **Sessions** can preserve working directory and environment across commands (default session / `enableDefaultSession`, `createSession`). See Sessions docs when state must carry across calls.- Interactive browser terminals often use **`sandbox.terminal(request)`** and session/xterm helpers on stable—not preview `createTerminal` unless the package is `@next`.- Prefer **RPC** transport when using tunnels or large/binary streaming. HTTP/WebSocket transports are deprecated (cleanup guide below).- Files, mounts, ports, tunnels, backups, lifecycle, and interpreter: use main docs for signatures; trust installed **stable** types.- Non-secret config in sandbox env; live credentials in the Worker. Use outbound handlers when processes call external APIs.

该 Skill 明确区分非敏感配置与实时凭据:非敏感配置可进入 sandbox 环境,实时凭据应留在 Worker 中;外部 API 调用应经出站处理器。

查看原文
SKILL.md:43来自说明文档打开原文件
- Files, mounts, ports, tunnels, backups, lifecycle, and interpreter: use main docs for signatures; trust installed **stable** types.- Non-secret config in sandbox env; live credentials in the Worker. Use outbound handlers when processes call external APIs.- Production preview hostnames need wildcard DNS on a custom domain when using those URL patterns.
SKILL.md:108来自说明文档打开原文件
- Typecheck against installed stable types  - No live secrets in sandbox env  - If using deprecated transports/helpers, finish or track [2026 deprecation](https://developers.cloudflare.com/sandbox/guides/2026-deprecation/) cleanup  
从这里开始 · 工作说明SKILL.md
sandbox-stable
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明

代码和说明中提到的操作

连接外部网站
SKILL.md:8来自说明文档打开原文件
Isolated Linux environments on [Cloudflare Containers](https://developers.cloudflare.com/containers/), driven from Workers.
SKILL.md:12来自说明文档打开原文件
This line is the **current stable** default npm package. The main [Sandbox documentation](https://developers.cloudflare.com/sandbox/) describes it. Existing apps can stay here and keep shipping.
SKILL.md:29来自说明文档打开原文件
| User wants to port to 1.0 / `@next` | **Stop.** Load **`sandbox-migrate-to-next`**. Do not half-apply preview APIs on a stable package. || Only cleaning deprecated stable APIs | Stay here; use the [2026 deprecation guide](https://developers.cloudflare.com/sandbox/guides/2026-deprecation/). That is **not** a move to `@next`. |
读取密钥或账号配置
SKILL.md:43来自说明文档打开原文件
- Files, mounts, ports, tunnels, backups, lifecycle, and interpreter: use main docs for signatures; trust installed **stable** types.- Non-secret config in sandbox env; live credentials in the Worker. Use outbound handlers when processes call external APIs.- Production preview hostnames need wildcard DNS on a custom domain when using those URL patterns.
读取文件
SKILL.md:99来自说明文档打开原文件
```shrg 'SANDBOX_TRANSPORT|transport:|exposePort\(|enableDefaultSession|execStream\(|readFileStream|writeFileStream'```
修改文件
SKILL.md:99来自说明文档打开原文件
```shrg 'SANDBOX_TRANSPORT|transport:|exposePort\(|enableDefaultSession|execStream\(|readFileStream|writeFileStream'```
读取了多少行
111
文件校验值(用于核对版本)
a3e8383ba58b74145428219829aedb37d16906ae2d727c8d71a860c09adbd53f