DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-guard

d

dsh-guard

Manifest valid

DSH (DeepSeek Harness) security guard plugin: blocks/asks on dangerous commands & sensitive paths, redacts secrets in tool output, local JSONL audit log + guard_report. DSH 安全护栏插件。

hasBundlePatch

dsh-guardrail · DSH 安全护栏

CI npm license

中文 | English

让 AI 删库之前先问你一声。 给 DeepSeek Harness (DSH) 加一道护栏:拦截危险命令和敏感文件访问,给工具输出里的密钥、手机号打码,并留下本地审计日志。

demo

功能

  • 🛑 危险命令拦截:内置 22 条规则,覆盖递归删除、格式化磁盘、fork 炸弹、git push --force、curl | sh、删注册表等。每条规则可以设为 deny(直接拒绝)或 ask(在网页里弹审批,你点批准才执行)。
  • 🔑 敏感路径保护:.env、SSH 私钥、云厂商凭据、浏览器 Cookie / 密码库、DSH 自己的凭据文件。
  • 🙈 输出脱敏:工具返回的内容在交给模型之前会先打码,内置 13 条规则(私钥、JWT、sk- key、GitHub / AWS / Slack / Google / Stripe token、Bearer、password= 一类键值、身份证号、中国和智利手机号),邮箱和智利 RUT 可选开启。
  • 📒 本地审计日志:按天追加写 JSONL,存在 $DSH_HOME/dsh-guard/。写入前先脱敏再截断,不会把密钥原文落盘。
  • 📋 guard_report 工具:问 AI“今天都干了啥”,它会返回一份中文日报。
  • 🧪 dryRun 演练模式:只记录、不拦截,方便先观察会误拦哪些命令。
  • 🪶 零侵入:通过 cordis.patch.yml 挂载,不用改 DSH 源码。

安装

建议先装到一个单独的测试 profile 里试用:

# 从 npm 安装
dsh plugin --profile <profile> add dsh-guardrail

# 或者用离线安装包
dsh plugin --profile <profile> add ./dsh-guardrail-0.1.2.tgz

启动后日志里出现 [dsh-guard] 已加载… 就说明装好了。

要重装同一个版本,先运行 dsh plugin --profile <p> remove dsh-guardrail 再 add,不然可能用到旧缓存。

要求:DSH ≥ 0.2.1-rc.5,Node ≥ 22。已在 Linux 和 Windows(PowerShell)上验证。

配置

在网页 Plugins → dsh-guardrail 里改,或者写进 profile 配置。

配置项默认值说明
enabledtrue总开关
dryRunfalse演练模式:只写审计日志,不拦截、不脱敏
announcetrue往系统提示里加一小段护栏说明(约 60 token)
ignoreTools["guard_report"]这些工具不做拦截检查
commandArgKeys内置列表哪些参数名算“命令文本”
pathArgKeys内置列表哪些参数名算“路径”
disabledRules[]要关掉的内置规则 id
rules[]自定义规则:{ id, kind: command|path, pattern, flags="i", action="ask", reason }
allow[]白名单正则,命中的参数不会触发拦截
redact.enabledtrue是否给工具输出打码
redact.modecontentcontent 只改模型看到的文本;value 改规范化后的 value(PTC 场景用)
redact.disabled[]要关掉的内置脱敏规则名
redact.emailsfalse给邮箱打码
redact.chileRutfalse给智利 RUT 打码
redact.extra[]自定义脱敏:{ name, pattern, flags="g", replacement="[REDACTED]" }
audit.enabledtrue写审计日志
audit.dir""日志目录,留空就用 $DSH_HOME/dsh-guard
audit.logAllowedtrue放行的调用也记下来
audit.logArgstrue记录参数预览(先脱敏再截断)
audit.maxArgChars200参数预览最多保留几个字符

没有审批通道时(比如 headless 运行),ask 会退化成拒绝,审计里记为 unavailable。

内置拦截规则

id类型动作说明
rm-rf-root-homecommanddeny递归删除根目录/用户目录/盘符
rm-rfcommandask递归强制删除 (rm -rf)
win-del-recursivecommandaskWindows 递归删除 (del /s、rd /s、rmdir /s)
remove-item-root-homecommanddenyPowerShell 递归删除根目录/用户目录/盘符
remove-item-recursecommandaskPowerShell 递归删除 (Remove-Item -Recurse)
format-diskcommanddeny格式化磁盘/分区
diskpart-bcdeditcommandask磁盘/启动项管理工具 (diskpart/bcdedit/vssadmin)
fork-bombcommanddenyfork 炸弹
shutdowncommandask关机/重启
reg-deletecommandask删除注册表项 (reg delete / Remove-ItemProperty on registry)
net-user-addcommandask新增系统用户/提权 (net user /add、net localgroup administrators)
git-push-forcecommandaskgit 强制推送 (--force / -f / --force-with-lease)
git-destructivecommandaskgit 破坏性操作 (reset --hard / clean -fd / branch -D 远端删除)
pipe-to-shellcommandask下载内容直接交给 shell 执行 (curl
env-filepathask.env 环境变量/密钥文件
ssh-private-keypathdenySSH 私钥
ssh-dirpathask~/.ssh 目录
dsh-credentialspathdenyDSH 凭据文件 (.credentials.yaml)
key-cert-filespathask证书/私钥文件 (*.pem, *.p12, *.pfx, *.ppk, *.key)
browser-secretspathdeny浏览器 Cookie / 登录数据库
cloud-credentialspathask云/CLI 凭据文件 (.aws/credentials, .git-credentials, .netrc, .kube/config, .docker/config.json)
system-secretspathdeny系统密码库 (/etc/shadow, Windows SAM)

guard_report 示例

📋 dsh-guard 日报 2026-11-04
工具调用共 4 次;拦截 1 次,询问 2 次(批准 1 / 拒绝 1)。
输出脱敏共 3 处(github-token×1、cn-phone×1、cl-phone×1)。
调用最多的工具:powershell×3、read_file×1

被拦截/询问的记录(最近 3 条,共 3 条):
- 23:21:05 [powershell] 已拒绝 · 规则 ssh-private-key · type C:\temp\id_rsa
- 23:21:40 [powershell] 询问→被拒绝 · 规则 reg-delete · reg delete HKCU\Software\DshGuardTest /f
- 23:22:10 [powershell] 询问→已批准 · 规则 remove-item-recurse · Remove-Item -Recurse X:\demo

日志文件:~/.dsh/profiles/<p>/dsh-guard/audit-2026-11-04.jsonl

局限(请务必读)

  • 这是基于正则的护栏,不是沙箱。 命令经过 base64 编码、变量拼接、写成脚本再执行,或者交给别的解释器跑,都可能绕过去。它防的是“AI 手滑”,防不了有意的对抗。
  • 只检查配置里指定的参数名,非标准工具的参数可能看不到。
  • 脱敏也是模式匹配,格式不常见的密钥可能漏掉,偶尔也会误打码。
  • 想要真正的隔离,请配合 DSH 的沙箱 / 容器、最小权限账号和只读挂载一起用。
  • 请不要把它宣传成“绝对安全”。

FAQ

会拖慢 DSH 吗? 不会。每次工具调用只多跑几次正则匹配,可以忽略。

误拦了怎么办? 把规则 id 加进 disabledRules,或者把对应命令写进 allow 白名单。也可以先开 dryRun 观察一天。

被拦之后 AI 会换个写法绕过吗? 拒绝消息里明确要求它不要绕。实测时 DeepSeek 都如实告诉了用户。但这只是约束,不是保证,见上面的局限。

审计日志会上传吗? 不会。日志只写在本地,插件不发起任何网络请求。

和 Windows 兼容吗? 兼容。规则覆盖了 del /s、Remove-Item -Recurse、reg delete、diskpart 这些命令,也已经在 Windows 真机上测过。

许可证

MIT


English

Make the AI ask before it nukes your repo. A guardrail plugin for DeepSeek Harness (DSH): blocks or asks before dangerous commands and sensitive file access, redacts secrets in tool output, and keeps a local audit log.

demo

Features

  • 🛑 Dangerous-command guard: 22 built-in rules covering recursive delete, disk format, fork bombs, git push --force, curl | sh, registry deletes and more. Each rule either uses deny or ask (an approval prompt in the web UI).
  • 🔑 Sensitive paths: .env, SSH keys, cloud credentials, browser cookies and password stores, and DSH's own credential files.
  • 🙈 Output redaction: 13 built-in patterns, including private keys, JWTs, sk- keys, GitHub/AWS/Slack/Google/Stripe tokens, Bearer tokens, password=-style pairs, CN ID cards, and CN and Chile phone numbers. Email and Chile RUT redaction are optional.
  • 📒 Local JSONL audit log in $DSH_HOME/dsh-guard/. Previews are redacted and then truncated before they are written.
  • 📋 guard_report tool: returns a daily summary in Chinese.
  • 🧪 dryRun: logs what would be blocked without blocking anything.
  • 🪶 Mounted via cordis.patch.yml, with no changes to DSH source.

Install

dsh plugin --profile <profile> add dsh-guardrail
# or offline
dsh plugin --profile <profile> add ./dsh-guardrail-0.1.2.tgz

Look for [dsh-guard] 已加载… in the startup log. Requires DSH ≥ 0.2.1-rc.5 and Node ≥ 22. Tested on Linux and Windows (PowerShell).

Configuration

The keys and defaults are the same as in the Chinese table above. The ones you'll use most are dryRun (false), disabledRules ([]), allow ([]), rules ([]), redact.mode ("content"), redact.emails (false), audit.dir ("" → $DSH_HOME/dsh-guard) and audit.maxArgChars (200). Without an approval channel (headless), ask falls back to deny and is logged as unavailable.

Rules

See the rule table above. Each rule has an id, a type (command or path) and an action (deny or ask).

Limitations

This is a regex guardrail, not a sandbox. Encoded commands, variable concatenation, scripts written and then executed, or other interpreters can bypass it. It catches accidents, not adversaries. Redaction is pattern-based too, so it can miss secrets or redact the wrong text. If you need real isolation, use it together with sandboxes or containers and least-privilege accounts. Please don't market it as "absolutely safe".

FAQ

  • Overhead? Negligible: a few regex matches per tool call.
  • False positive? Add the rule id to disabledRules or a pattern to allow, or start with dryRun.
  • Does anything leave my machine? No. The plugin makes no network requests.

License

MIT

Comments

Loading…

Similar plugins

dsh-safeguard

by ZhijiangTang

DSH plugin: block dangerous shell commands and secret leakage before execution (tools/pre-execute veto)

Security & AuditDevelopment & InfrastructureManifest valid

★ 0

↓ 58/wk

MIT

JavaScript

Aug 16, 2026

dsh plugin --profile web add dsh-safeguard

by jkrandom-sudo

Security audit for DeepSeek Harness plugins: static permission profile with file/line evidence + a runtime sentinel gating credential access and unknown-host egress · DSH 插件安全审计:静态权限画像(附文件/行号证据)+ 运行时哨

Manifest valid

★ 4

↓ 85/wk

MIT

TypeScript

Sep 11, 2026

dsh plugin --profile web add dsh-plugin-audit

by zhaoxuejie

DeepSeek Harness 工具调用安全守卫(防火墙)插件:危险命令拦截、路径白名单、敏感文件黑名单、人工审批与审计

Security & AuditManifest valid

★ 0

MIT

TypeScript

Sep 8, 2026

dsh plugin --profile web add dsh-plugin-tool-guard

by Yazzyk

DeepSeek Harness (dsh) 插件:在 Web GUI 里手动点选文件或目录,屏蔽 agent 对它们的读取、搜索、写入与编辑。A dsh plugin that denies an agent read/search/write/edit access to chosen files and directories, picked from the plugin's own We

Security & AuditDevelopment & InfrastructureManifest valid

★ 2

MIT

JavaScript

Oct 10, 2026

dsh plugin --profile web add dsh-file-shield

by ChenChen913

One-click local security checkup button for the DeepSeek Harness (DSH) Web UI: read-only checks (!!js config, third-party plugins, credential file perms, instruction files), severity-graded report, pl

Security & AuditTerminal & ClientsManifest valid

★ 0

MIT

JavaScript

Sep 11, 2026

dsh plugin --profile web add dsh-security-doctor

by 863683348

Installation safety gate for DSH plugins: antivirus-style scan of install scripts, permissions, secrets and network callbacks on local directories or npm tarballs, returning a BLOCK/WARN/PASS verdict

Security & AuditTools & CapabilitiesDevelopment & InfrastructureManifest valid

★ 0

MIT

JavaScript

Sep 11, 2026

dsh plugin --profile web add dsh-plugin-gate