dsh-plugin-gate
github.com/863683348/dsh-plugin-gate
v1.3.2
其他
以 shell 执行命令写入文件动态执行代码
插件市场膨胀迅速(数千条目),恶意代码混入插件只是时间问题。本插件为 agent 提供 `gate_scan` 工具,可扫描插件源码——**本地目录**或 **npm tarball**——检测经典恶意代码形态:
作者原文(英文)
Installation safety gate & data-protection guard for DeepSeek Harness: 60 static signature rules scan plugin sources for malicious install scripts, credential theft, obfuscation and network callbacks before 'dsh plugin add', with scan baselines (gate_diff
中文简介由 DeepSeek 模型翻译,仅供参考。
deepseek-harnessdshdsh-plugincordispluginsecurityscanaudit
检测报告
关注度高。命中了不少能力模式,其中可能有需要留意的。逐条看下面的清单。
1高关注4需留意2一般17未命中
高关注需留意一般
能力清单
- 以 shell 执行命令
shell-exec高关注4 处命中lib/rules.js:65hint: "spawn/exec with shell:true runs strings through a shell; command injection risk.",README.md:9| **Scripts** | npm lifecycle scripts (pre/install/postinstall), exec/spawn/shell:true, curl|sh, encoded PowerShell, cmd…README.md:87Context-aware rules: `exec()`/`execSync()` hits are downgraded when the file does not import `child_process` (typical `R…README.zh.md:9| **脚本** | npm 生命周期脚本(pre/install/postinstall)、exec/spawn/shell:true、curl\|sh、编码 PowerShell、cmd/WSH 启动、动态 require |- 看命令字符串是拼出来的还是写死的。拼接用户输入才是真正的风险。
- 写入文件
writes-files需留意11 处命中lib/rules.js:252re: /(writeFile(?:Sync)?|appendFile(?:Sync)?|createWriteStream|mkdir(?:Sync)?|unlink(?:Sync)?|rm(?:Sync)?|rename(?:Sync)…lib/rules.js:260re: /(writeFile(?:Sync)?|appendFile(?:Sync)?|createWriteStream|mkdir(?:Sync)?)\s*\([^)\n]{0,160}(~[\\/]|\$HOME|os\.homed…lib/rules.js:268re: /(writeFile(?:Sync)?|appendFile(?:Sync)?|createWriteStream)[^\n]{0,120}(\.bashrc|\.zshrc|\.profile|\.npmrc|autoexec)…- 看写入位置。写自己的配置目录是正常的,写系统目录不是。
- 动态执行代码
dynamic-code需留意5 处命中lib/rules.js:136name: "eval()",lib/rules.js:144name: "new Function()",lib/rules.js:162hint: "vm.runIn* executes strings; often used to hide payloads from static analysis.",README.md:10| **Obfuscation** | eval / new Function / vm.runIn*, hex-escape floods, base64 blobs, char-array packing |- 看 eval / new Function 的入参来自哪里。常量字符串和用户输入是两回事。
- 发起网络请求
network需留意1 处命中lib/rules.js:316name: "fetch() call",- 看请求发往哪些域名。发往作者自己的后端是常见做法。
- 启动伪终端
spawns-pty需留意1 处命中README.zh.md:40上下文感知:文件未 import `child_process` 时,`exec()`/正则 `RegExp#exec` 命中会被降级,减少误报;代码执行类规则(exec、eval、curl|sh、PowerShell…)出现在**注释或文…- 伪终端等于给了一个完整 shell。确认这是插件的核心功能。
- 接触凭据或密钥
credentials一般39 处命中lib/index.js:10* malicious install scripts, dangerous permissions/fs usage, credentiallib/index.js:61const GATE_SECTION_TEXT = "Installation safety gate: before installing any plugin from a marketplace, npm registry, or u…lib/index.js:137description: "Installation safety gate for plugins: scan a plugin source (a local directory, or an npm package via the n…lib/rules.js:12* cloud-metadata probes, private keys, credential reads).- 看它读取哪些凭据、发往哪里。用于登录自己的服务是正常的。
- 动态加载模块
dynamic-import一般1 处命中lib/scan.js:493const { extractTarball } = await import("./targz.js");- 动态导入本身无害,但会让依赖关系难以静态审阅。
逐条扫描明细
| 能力 | 标识 | 关注度 | 命中次数 |
|---|---|---|---|
| 以 shell 执行命令 | shell-exec | 高关注 | 4 |
| 写入文件 | writes-files | 需留意 | 11 |
| 动态执行代码 | dynamic-code | 需留意 | 5 |
| 发起网络请求 | network | 需留意 | 1 |
| 启动伪终端 | spawns-pty | 需留意 | 1 |
| 接触凭据或密钥 | credentials | 一般 | 39 |
| 动态加载模块 | dynamic-import | 一般 | 1 |
这份报告的口径
扫描读的是包里的源码,全程不执行第三方代码。 本次读了 14 个文件,扫描于 2026-10-14。 命中次数只说明源码里出现过这类调用,不说明行为好坏——一个插件读写文件 500 次和 1 次 都会被记为「读取文件」。这是能力清单,不是信任评分,也不是安全结论: 没扫出来的能力可能只是写法没被规则覆盖。
依赖安全公告
已查询这个插件声明的全部依赖,没有匹配到已公开的安全公告。(含 DSH 框架包在内的 @deepseek-ai/* 不作查询——那是运行时自己的问题,不是插件的。)