Skip to content

dsh-strip-sandbox-permissions

Verified

dsh-strip-sandbox-permissions · v0.1.0 · MIT

Strip sandbox_permissions / justification from model tool-call arguments so sandbox escalation is never triggered when the session already has sufficient permission.

Install

dsh plugin add dsh-strip-sandbox-permissions

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Readme

dsh-strip-sandbox-permissions

一个可分发、零依赖的 DeepSeek Harness(DSH)插件:忽略模型工具调用参数里携带的 sandbox_permissions / justification 字段,避免沙箱权限误拒绝。

解决的问题

部分模型(后训练倾向)会在工具调用参数里自动带上 sandbox_permissions(及其配套 justification)。当会话已处于足够权限(例如完整访问权限)时,携带一个非严格加宽的 值会触发 DSH 沙箱的误拒绝:

Error: sandbox escalation to "workspace-write" is not strictly wider than this call's current "workspace-write" mode

本插件在 llm/stream 瀑布流(所有模型工具调用的必经点)拦截 block-end 块,从工具 参数对象顶层删除这两个字段后再交给装配器。只剥离这两个升级专属字段,其余参数原样 保留;未命中时零开销透传。会话日志与重放看到的是剥离后的干净参数,保持一致。

安装(对方 DSH)

方式一:npm registry(若已发布)

dsh plugin --profile <你的profile名> add dsh-strip-sandbox-permissions

方式二:本地 tarball(未发布时)

# 拿到 dsh-strip-sandbox-permissions-0.1.0.tgz 后
dsh plugin --profile <你的profile名> add ./dsh-strip-sandbox-permissions-0.1.0.tgz

安装完成后重启 DSHdsh web / 对应 profile)即生效,无需其它配置。验证:

dsh plugin --profile <你的profile名> list   # 应包含 dsh-strip-sandbox-permissions

打包(作者)

cd dsh-strip-sandbox-permissions
npm pack          # 产出 dsh-strip-sandbox-permissions-0.1.0.tgz

把 tarball 发给对方即可;对方按上面“方式二”安装。

原理简述

  • 工具执行参数在 createExecution 时被深冻结,tools/pre-execute 只能 allow/deny/ask, 无法改写参数;唯一正确的拦截点是 llm/stream 瀑布流。
  • 适配器(如 @deepseek-ai/dsh-llm-deepseek@deepseek-ai/dsh-llm-pi-ai)在流末尾以 block-end 块携带完整组装的工具调用块(arguments 为完整 JSON 字符串)。
  • 本插件在该点解析 arguments,删除顶层 sandbox_permissions / justification 后重新 序列化;非法 JSON、非对象、无这两个字段时原对象透传。

卸载

dsh plugin --profile <你的profile名> remove dsh-strip-sandbox-permissions

或直接删除 profile package.json 中对应依赖与 dsh.profile.bundles 条目、cordis.patch.yml 中对应行后重启。

License

MIT