dsh-preset-tool-guard

DSH PLUGIN安全与权限

仓库 kouzakiumi/dsh-preset-tool-guard · npm dsh-preset-tool-guard

安全与权限 未标注验证等级 安全审查:未标注 可信度:未标注 可安装插件
安装这个插件

为 DeepSeek Harness 提供按 Agent preset 限制工具可见性的 DSH plugin,通过 ctx.tools.restrict() 屏蔽全局继承的工具,让每个 preset 只暴露该有的能力。

一句话选型结论

按资料字段整理

dsh-preset-tool-guard 是安全与权限类的 DSH 可安装插件,未做沙盒验证,暂无安全审查结论,列出 5 项功能,有可直接复制的安装命令。验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么;涉及密钥或系统权限的,建议先在隔离环境试装。

分类安全与权限 收录类型可安装插件 验证等级未标注验证等级 安全审查未标注
验证等级 UNKNOWN 未标注验证等级
GitHub 星标 0 复刻 0 · 未关闭 issue 0
最近更新 2026-10-05 创建于 2026-10-04
README 12.3 KB 正文体量,越大说明说明书写得越细

安装

可安装插件
在 DSH 里执行,装完用 dsh plugin list 确认已挂上;标了 L4 / L5 的命令已在沙盒里真实跑通
dsh plugin --profile web add dsh-preset-tool-guard
  1. 1
    确认版本与运行环境

    仓库没有标注兼容版本与 Node.js 要求,先确认你的 DSH 版本能装,再继续。

  2. 2
    执行安装命令

    在 DSH 里执行上面的命令;多包仓库要注意区分具体子包名,别装错包。

  3. 3
    确认已挂载

    用 dsh plugin list 查看列表里是否出现这个插件,出现即挂载成功。

  4. 4
    试跑并检查权限

    加载后跑一个最小用例,确认它能正常工作;同时看它申请了哪些文件、命令或网络权限。

兼容 DSH 版本未标注版本不匹配时安装会报错
Node.js 要求未标注来自仓库 package.json 的 engines 字段
前置依赖无需要同时安装的同级依赖
npm 包名dsh-preset-tool-guard可用 npm view 查看包信息

能做什么

5 项功能
字段来自项目仓库与公开索引,中文说明由本站标注

dsh-preset-tool-guard:为 DeepSeek Harness 按 preset 收敛 Agent 可见工具

  • 按 preset 限制工具可见性
  • 屏蔽全局继承的工具
  • provider 仍保持挂载
  • 限制仅作用于单个 Agent
  • 支持 dryRun 预演配置

上游标签

agent-presetcordis-plugindsh-bundledsh-pluginguardrailssecuritytool-calling

验证等级与安全审查

未标注验证等级
自动化流程结论,不是人工审核
验证等级未标注验证等级上游未给出验证结论,安装前请自行确认
安全审查未标注静态分析结论,未标注不代表已通过审查
仓库健康度未标注按仓库活跃度与最近更新时间给出
可信度未标注综合仓库活跃度与验证结果

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有可直接复制的安装命令,不用自己翻文档找入口。
  • 列出了 5 项功能,能直接看出它解决什么问题。

先想清楚的地方

  • 安全审查还没结论,装之前先看仓库改了什么、要什么权限。
  • 没有声明 Node.js 版本要求,版本不匹配可能装不上。
  • 验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么。

更适合

  • 需要在安全与权限场景里给 DSH 补能力的人。
  • 能接受在本地装依赖、愿意自己确认权限的人。

不太适合

  • 只使用 DSH 官方内置能力、不接受第三方插件的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
插件验证等级安全审查星标兼容版本安装命令
dsh-preset-tool-guard当前 未做沙盒验证 未标注 0 未标注 有
dsh-infinite-gen-4 未做沙盒验证 未标注 1,611 未标注 无
cc-safety-net 未做沙盒验证 未标注 1,591 未标注 无
dsh-wallpaper-engine L5 · 运行验证通过 低风险 1,018 0.2.0-rc.2 等 10 个 有
api-relay-audit L5 · 运行验证通过 低风险 875 0.2.0-rc.2 等 10 个 有
hol-guard L4 · 沙盒安装通过 不在扫描口径 828 未标注 有

仓库档案

安全与权限
字段来自项目仓库与公开索引,中文说明由本站标注
作者 / 维护方kouzakiumi仓库 dsh-preset-tool-guard · 默认分支 main
分类安全与权限admin-security
收录类型可安装插件声明了 dsh.bundle、可用 dsh plugin add 安装的条目
开发语言JavaScript仓库主语言
许可证MIT商用或二次分发前请确认条款原文
星标 / 复刻 / issue0 / 0 / 0收录时的数值,非实时
创建 / 更新2026-10-04 · 2026-10-05最后推送 2026-10-05
本站收录2026-10-06首次进入本站目录的时间

README 全文

12.3 KB
作者原文,中文版优先;只做安全转义,不改内容

dsh-preset-tool-guard

Per-preset tool visibility for DeepSeek Harness (dsh).

Mount it once at the host level. It watches agent/created, reads the preset that agent actually
composed, and applies the official ctx.tools.restrict() seam on that agent's own scope — so each
preset exposes only the tools it should, while the heavy providers stay mounted and untouched.

简体中文说明见 README.zh.md


The problem

dsh resolves tools along agent → preset → global. A preset composition mounts its own rows; it
does not restrict what is inherited from the global layer. So any plugin mounted at the host level
— a computer-use driver, browser MCP servers, image providers — shows up in the model's tool catalog of
every preset, including minimal ones that were designed to expose two or three tools.

Disabling those providers is not the answer: you lose the capabilities entirely, and it affects every
preset and session. The upstream discussion for the preset half of this is
deepseek-ai/deepseek-harness#5786.

ctx.tools.restrict({ allow, deny }) is the public, agent-scoped answer: a restriction masks what the
scope inherits (the global layer and every ancestor scope layer) and never what the scope registers
itself. This plugin wires that seam into the preset lifecycle.

What it changes

Effect
Model-facing tool schemas (the per-request prefix) the masked tools are gone
PTC mode SDK surface gone as well (both projections read the same view)
Dispatch masked calls return UNKNOWN_TOOL — a real mask, not a presentation filter
Other agents / presets unaffected; a restriction is per scope
The provider itself still mounted; every capability you kept keeps working

Install

Requirements: Node ^22.19 or >=24 (see engines), and a harness that exposes
ToolRuntime.restrict() plus the agent/created event.

The package ships its own cordis.patch.yml, so installing it mounts the plugin row.

# any dsh CLI (TUI, web profile, …)
dsh plugin --profile  add dsh-preset-tool-guard

# from GitHub
dsh plugin --profile  add github:KouzakiUmi/dsh-preset-tool-guard

# from a local checkout
dsh plugin --profile  add /path/to/dsh-preset-tool-guard

DSH Desktop has no dsh on PATH. The GUI executable is the Electron shell, not the CLI — passing
plugin … to it does not run a plugin command. Use the terminal shim that the desktop ships
(verified on DSH Desktop 2.0.17-next, core 0.2.0-rc.2):

$env:ELECTRON_RUN_AS_NODE = '1'
& "C:\Program Files\DSH NEXT\DSH NEXT.exe" --expose-internals `
"C:\Program Files\DSH NEXT\resources\app\lib\desktop-cli.js" `
plugin --profile desktop add dsh-preset-tool-guard

Both forms end up in pnpm inside the profile directory (plugin forwards its arguments to pnpm), so
add / remove / install all behave as you expect. Note that --profile is mandatory, and that the
bundled dsh refuses to boot a profile literally named desktop outside the Electron path.

Then restart DSH: the plugin is a host-side bundle, so the running process keeps its old tree.
On load, the plugin also sweeps existing agents returned by agents.list() and applies their rules.

To remove it, run the same command with remove, and delete the preset-tool-guard entry from your
profile patch (see below). Removing the package row alone leaves a dangling config block.

The npm package is dsh-preset-tool-guard; use dsh-preset-tool-guard@0.1.2 to pin this release.

Configure

The plugin's own patch ships a conservative default (dryRun: true, no allowlists). Put the real
configuration in your profile's cordis.patch.yml. Loader config for the same entry id is replaced
wholesale
, so restate every field you care about — including dryRun, which otherwise falls back to
the code default false (masking enabled).

- id: preset-tool-guard
config:
allowlists:
minimal: [bash, pwsh, str_replace_editor]
standard: [read, write, edit, glob, grep, pwsh, skill, todo_write, web_search, memory_recall]
text: [read, write, edit, glob, grep, pwsh, grok_imagine_edit]
deny: []
denyPrefixes: []
groups: {}
disableGroups: []
skipUncomposed: true
report: true
# reportFile may be omitted (defaults to $DSH_HOME/logs/preset-tool-guard.log).
# A leading `~` is expanded; an absolute path is used as-is.
reportFile: C:/Users/you/.dsh/logs/preset-tool-guard.log
dryRun: false
Field Default in code Meaning
allowlists {} { presetId: [toolName, …] }. A matching preset keeps only the listed inherited tools; every other inherited tool is masked (fail-closed: a tool registered later on an inherited layer is not admitted, because the filter is a snapshot). An empty array or a list with no restrictable matches skips only the allowlist with a warning; the inherited tool surface is not cleared, and bottom rules still apply. Presets absent from this map get no allowlist, but still receive the deny / group rules below.
deny [] Exact tool names removed from every agent, composed preset or not.
denyPrefixes [] Plain startsWith prefixes removed from every agent (e.g. cua_driver_native__).
groups {} Named groups: { groupId: { names: […], prefix: "…" } }.
disableGroups [] Group ids whose members are removed from every agent.
skipUncomposed true Skip the allowlist for agents with no composed preset. The deny / group half still applies to them.
report true One report line per (re)application.
reportFile $DSH_HOME/logs/preset-tool-guard.log Append reports here. false or "" disables file output. ~ is expanded; omit the field to use the default.
dryRun false Measure and report only; change nothing. Start here when tuning.

How it works

  • The restriction is applied on agent.ctx — the agent's own scope. restrict() derives the scope
    from the calling context and refuses to run from a plain (unscoped) one.
  • The filter is snapshotted at registration. allow therefore keeps admitting only the names it
    listed at that moment; a name that appears later on an inherited layer is not admitted. If you
    need a late-registering provider to be visible, create a new agent after it registers.
  • For that reason an allowlist match installs its mask even when nothing is currently excluded —
    that is what keeps future inherited tools out. Skipping the install would silently turn a fail-closed
    policy into a fail-open one.
  • Names are resolved against the scope's restrictable set before the call: a name the agent cannot
    see is skipped (never thrown), so a provider upgrade that renames a tool degrades to a smaller saving
    plus a report note, not to a startable-but-broken deployment.
  • ToolRuntime.view() is not part of the documented Service contract. The plugin probes it and, if it
    is unavailable, skips masking and says so rather than falling back to schemas() — the two sets
    differ (schemas include the agent's own layer and the reserved transport name), and feeding those
    names to restrict() would make the whole call fail.
  • The reserved PTC transport run_code is never written into a filter.
  • An allowlist with no restrictable matches is skipped with a warning; deny, prefixes and disabled
    groups still apply. An empty allowlist therefore does not clear the inherited tool surface.
  • Late registrations receive bottom rules. The plugin listens to tools/change and adds denials
    for newly matching inherited names, including providers connected after agent creation. It does
    not rebuild the allowlist snapshot or admit late allowlisted names. Repeated events add no duplicate
    denials. Dry run reports these names without installing restrictions.
  • Every failure path logs and returns; agent creation is never blocked.
  • Preset switches are handled. Upstream recompose (used when a blank session changes preset) only
    rebinds the mount — it does not re-emit agent/created. The plugin listens for
    agent-preset/selected, releases the previous restriction and re-applies, because restrictions
    intersect and cannot be widened in place.
  • The mask has plugin ownership too. restrict()'s disposer is kept per agent and released when the
    agent is disposed and when the plugin itself unloads, so a config reload cannot leave a stale mask
    behind on a live agent.

Reporting

2026-10-04T12:34:56.789Z preset-tool-guard: excluded 114/168 inherited names (155810 of 199433 utf8 schema bytes, 78.1%, ~43281 tokens) agent="session-…" preset="standard" mode=allowlist
  • excluded / would exclude (the latter under dryRun), and mode=allowlist|bottom.
  • Counts and sizes describe the inherited surface: names the restriction excludes out of the names
    the scope could restrict. Visible-tool counts can differ (see the two exceptions below).
  • Sizes are UTF-8 bytes of the serialized schema, converted to a rough token estimate at 3.6 bytes per
    token — a magnitude, not a tokenizer measurement.
  • On a no-op it prints 无需掩码 / no mask needed instead.
  • The same line is appended to reportFile with an ISO timestamp. The host logger's output channel is
    not necessarily a readable log file, so the file is the reliable record.

Measured on a desktop profile (core 0.2.0-rc.2): standard went from roughly 60K tokens of tool
prefix to about 10.5K of schema, with a computer-use driver (62 tools), two browser MCP servers (55
tools) and image providers excluded from the everyday presets — and still fully available in a full
preset that simply declares no allowlist.

Two ways a name stays visible

restrict masks only what a scope inherits. Two consequences are worth knowing before you file a
bug:

  1. Self-layer registrations. Tools a plugin registers on the agent's own layer are outside the
    filter. On one machine subagent, list_subagent_models, schedule_* and cordis_inspect_*
    behave this way: they stay visible no matter what the allowlist says. An allowlist cannot remove
    them — turn such a tool off in its own plugin's configuration.
  2. Not registered at that moment. A name whose provider is not connected, or not yet mounted when
    the agent is created, is skipped. Keeping it in the allowlist does not reserve visibility for
    later either (see the snapshot rule above); it only avoids a name-collision error.

The report line separates the two cases so you can tell them apart without guessing.

Development

npm test
node scripts/check-manifest.mjs
node scripts/check-patch.cjs [profileDir] [toolsJson] [--strict]

Defaults: profileDir = $DSH_HOME/profiles/desktop, toolsJson =
$DSH_HOME/tmp-guard-tools.json. It parses your profile patch with the !!js tag supported, prints
every preset-* declaration and the per-preset allowlist sizes, and — when the tool catalog file
exists — reports allowlist names the catalog does not contain.

The catalog file accepts either shape, so a raw cordis_inspect_query result can be written to disk
as-is:

  • { "tools": [ { "name": "read", … }, … ] } (host / Tool / listTools output)
  • [ "read", "write", … ]

Exit code is 0 on success and 1 on a parse failure, a structurally invalid patch, an unrecognizable
catalog shape, or (with --strict) a missing tool name. Without --strict, missing names are warnings
— names can legitimately be absent on another platform (the shipped bash row is Windows-disabled).

Compatibility

Verified on @deepseek-ai/dsh-* 0.2.0-rc.2 (Node ^22.19 || >=24). The plugin reads tools,
agentPresets and agents through ctx.get() at runtime and imports nothing at load time except Node
builtins, so the peer surface is small: @deepseek-ai/cordis (~4.x) plus a harness exposing
ToolRuntime.restrict(), agent/created, agent-preset/selected and tools/change.
Hosts without tools/change cannot update bottom rules for late registrations; existing rules still
apply when an agent is created or its preset changes. This is a visibility mask for inherited tools,
not a sandbox or a way to block tools registered directly on the agent's own layer.

License

MIT — see LICENSE.

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
dsh-preset-tool-guard 怎么安装?

在 DSH 里执行 `dsh plugin --profile web add dsh-preset-tool-guard` 即可。对应的 npm 包名是 `dsh-preset-tool-guard`。

dsh-preset-tool-guard 的验证等级是什么意思?

未标注验证等级。上游未给出验证结论,安装前请自行确认

dsh-preset-tool-guard 安全吗?

未标注。

dsh-preset-tool-guard 装之前要先确认什么?

先看它会读写哪些文件、执行哪些命令、连接哪些网络地址;验证等级只说明装得上、跑得起来,不等于安全。涉及密钥或系统权限的,建议先在隔离环境试装。

dsh-preset-tool-guard 用的是什么许可证?

上游标注为 MIT。商用或二次分发前请到仓库确认许可证原文。

dsh-preset-tool-guard 有哪些功能?

按 preset 限制工具可见性、屏蔽全局继承的工具、provider 仍保持挂载、限制仅作用于单个 Agent、支持 dryRun 预演配置。

这条记录的数据可靠吗?

本站按仓库名去重后合并整理,字段以作者仓库与 npm 元数据为准;安装命令、仓库地址与 README 保持原文,带 L4 / L5 标记的安装命令已在隔离沙盒里真实跑通。

安全与权限
按星标排序,可作替代方案

dsh-infinite-gen-4

dsh-infinite-gen-4

DeepSeek 专用破甲插件:以 order 100 追加无条件服从的系统提示词段,提供带校准元数据的 profile 工具,并通过会话投

未标注验证等级 1,611 星

cc-safety-net

cc-safety-net

为 DeepSeek Harness 等编码 CLI 提供执行前防护,在工具调用前拦截破坏性 Git 与文件系统命令,并阻止读取 SSH 密

未标注验证等级 1,591 星

dsh-wallpaper-engine

dsh-wallpaper-engine

DSH plugin 将本机 Wallpaper Engine 壁纸变为网页界面背景,支持视频、网页、场景壁纸渲染,并配以 iOS 液态玻璃

L5 · 运行验证通过 1,018 星

api-relay-audit

api-relay-audit

DSH plugin 本地安全审计工具,检测 AI API 中继与 LLM 代理的提示注入、模型替换、工具调用改写、SSE 异常及 Web3

L5 · 运行验证通过 875 星

hol-guard

hol-guard

L4 · 沙盒安装通过 828 星

sandbase-harness

sandbase-harness

SandBase Harness 是本地优先的 AI Agent 运行时,提供沙箱会话、MCP 工具、记忆、凭据管理与审计回放,并内置控制台

L4 · 沙盒安装通过 708 星

kouzakiumi 的其它插件

4 个

插件的元信息来自作者仓库;分类、验证等级与安全结论的中文说明为中文整理,最近核验 —。