dsh-sandbox/packages/sandbox/sandbox官方

175.3kStar19.0kFork0Issue752Watching

定义进程沙箱隔离服务契约 ctx.sandbox,提供 SandboxMode、policy 等词汇表,实现 confine() 方法返回受限运行的 argv,为 dsh 插件提供沙箱隔离能力

机审证据安装命令仓库已核验dsh-plugin Topic许可证READMEAI 百科

此插件是大仓库 deepseek-ai/deepseek-harness 的子包,星数与活跃度统计的是整个仓库。

语言
TypeScript
License
MIT
分支
master
ai-agentscordisdshdsh-plugin

安装

$ dsh plugin --profile web add npm:@deepseek-ai/dsh-sandbox

在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程

对话式安装

帮我安装 DeepSeek Harness 插件 deepseek-ai/deepseek-harness/packages/sandbox/sandbox:先查看仓库 https://github.com/deepseek-ai/deepseek-harness 确认安全性,然后执行安装命令并验证插件加载成功。

把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。

English | 中文

Process-sandbox Service Definition. Owns the ctx.sandbox service contract (SandboxProvider) and the confinement vocabulary the harness shares: SandboxMode (read-only / workspace-write / danger-full-access, file effects only), SandboxEnforcement (full / partial, per kernel ABI), SandboxExecutionPolicy (the complete per-call mode + workspace root), SandboxPolicy (its confined subset), and the fail-closed SANDBOX_UNAVAILABLE error. As the Service Definition role of the capability-seam split, it depends only on cordis (+ the harness error base), never on a backend.

The contract in one line: ctx.sandbox.confine(argv, policy) returns the argv to spawn INSTEAD of your own — wrapped so the process (and everything it spawns) runs confined — plus the selected backend's enforcement completeness, denial dialect (denialSignatures), and structured runner-failure evidence (runnerFailureRules); when no backend is usable it throws rather than passing the argv through unconfined. The core type catalog owns the exact classifier shape.

Policy rides the call, not the provider: two consumers may confine under different policies at the same instant (bash under read-only while a confined child agent keeps its state directory writable), and an approved escalated retry is just a new call with a wider policy.

Same-world confinement only. A backend shares the host's filesystem and kernel (bwrap, Landlock, Seatbelt); workspaceRoot names the filesystem-canonical real host directory. Workspace identity is resolved before lexical normalization, so a valid cwd containing symlink/.. grants the directory where chdir actually lands rather than an unrelated lexical parent. Containers, microVMs, and remote executors are NOT backends of this seam — they replace the Service Providers for whole capability seams (ctx.shell, ctx.fs) as environment-coherent groups. The boundary and its rationale: the sandbox Agent Note.

Implementations: @deepseek-ai/dsh-sandbox-local (Linux: bwrap, else the per-platform Landlock launcher; macOS: sandbox-exec/Seatbelt). Consumers: @deepseek-ai/dsh-bash-sandbox (wraps ['bash', '-c', command]).

Model Experience

Confinement error, indirectly

What the model sees

Through dsh-bash-sandbox and dsh-tool-bash, failure to enforce a requested mode produces code SANDBOX_UNAVAILABLE and the exact error below. An execution-time runner failure adds Runner failure: <detail>.

Exact error
sandbox mode "<mode>" is requested but no sandbox backend is usable on this host; refusing to run the command unconfined. Install bubblewrap or run a Landlock-enforcing kernel (Linux), ensure sandbox-exec is usable (macOS), or ensure the ACL restricted-token runner can start (Windows) — otherwise switch the consumer to danger-full-access.

Token effect

Conditional error text is visible for that call and retained in history until compaction.

KV Cache effect

Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.

Known Limitations and Deferred Work

  • File effects are the whole policy vocabulary — the seam expresses no network, process, syscall, device, or credential restrictions.
  • Same-world confinement only — containers, microVMs, and remote execution require replacing capability implementations rather than adding a provider here.
  • Denial reporting is a stderr dialect — the seam returns backend signatures instead of a typed runtime denial channel, so consumers that need classification must infer it from the child process's output.
  • Runner diagnostics are in-band — exit status plus stderr evidence cannot prove which process wrote a matching line, so a confined child that deliberately mimics its runner can cause an availability/diagnostic false attribution. This cannot bypass confinement; an out-of-band runner-status channel is deferred.
  • One provider per context — composing different sandbox mechanisms simultaneously requires a provider-level ladder or separate Cordis contexts; callers choose policy per call, not backend identity.

收录徽章

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/deepseek-ai/deepseek-harness/packages/sandbox/sandbox)

把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。

返回插件目录