ShanHaiFish / dsh-plugin-security-review

Listed

DSH 动态 Cordis 插件安装安全审查守卫 (DeepSeek Harness plugin install security review gate, security-first)

mainOther View source

Installation

npx -y @deepseek-ai/dsh plugin --profile web add github:ShanHaiFish/dsh-plugin-security-review

This installation command is an unverified starting point generated from the GitHub repository address.

README

Maintainer-authored documentation snapshot.

View on GitHub ↗
Commit f4362c8Synced Aug 18, 2026

Plugin Install Security Review(v1.5.0)

English: README.en.md · 简体中文: 本文档

DSH 插件安装安全审查守卫。对 cordis_define / cordis_run 安装或运行的动态插件源码做静态安全审查,并按安全优先策略拦截;同时提供 plugin_security_review / plugin_security_audit 两个审查工具。

v1.5.0 起为静态 bundle 插件,随 profile 层栈自动加载,不再需要每次重启 DSH 后重新 define/run。

仓库内容

路径说明
package.json + cordis.patch.yml + lib/静态 bundle(推荐):dsh plugin add 安装后开机自启动
manifest.json + package-source.js动态插件回退形态(v1.4.0):无 bundle 能力的 profile 按 README 恢复流程加载
tests/gate.test.mjs动态形态行为测试(node tests/gate.test.mjs)
tests/static.test.mjs静态形态行为测试(node tests/static.test.mjs)

安装(静态 bundle, 推荐)

dsh plugin --profile web add dsh-plugin-security-review

本地未发布时用 file: 指向本仓库(注意路径不能含空格):

dsh plugin --profile web add file:/path/to/dsh-plugin-security-review

重启 dsh web 后守卫即自动生效:plugin_security_audit(无参数)应显示「守卫: 运行中 (v1.5.0)」。

安装(动态插件, 回退)

仅用于没有 bundle 能力的 profile。步骤:

  1. 让 agent 读取 package-source.jsmanifest.json
  2. cordis_define:plugin: { kind:"new", idPrefix:"secur" },name/purpose 取 manifest.json,code.hostpackage-source.jsreturn { ... } 之后的内容。
  3. cordis_run 激活;plugin_security_audit 验证。

动态形态不跨 DSH 进程存续,重启后需重新加载;静态 bundle 形态无此限制。

v1.5.0 变更(相对 v1.4.0 动态形态)

  • 静态 bundle 化:命名导出 name/inject/apply,经 ctx.tools.register(defineTool(...)) 注册工具,经 ctx.on('tools/pre-execute') 拦截,开机自启动。
  • 移除动态自升级豁免:静态形态经 dsh plugin update 升级,cordis_define/cordis_run 对所有动态插件一律审查,不再有 secur 前缀/谱系令牌豁免;源码不可检索时一律 fail-closed(ask)。
  • 审查引擎、评分模型、能力声明、跨会话批准持久化、库存审计与 v1.4.0 保持一致。

判定策略(安全优先)

判定条件行为
BLOCKcritical>0 或 high≥2 或 总分≥100拒绝安装/运行,附完整报告
ASKhigh≥1 或 总分≥40走审批服务要求人工批准(审批禁用时等效拒绝)
WARN总分≥10放行,卡片附审查报告
ALLOW其余放行

风险权重:critical=100, high=40, medium=15, low=4,总分上限 300;能力声明项计分减半(最低 1 分)。

审查覆盖面

  • Host 规则:不安全进程执行(exec/execSync/shell:true — critical)、VM 逃逸、Node 内部 API、构造器链逃逸、宿主进程终止(critical);子进程执行能力(spawn/fork — high)、原型污染、动态代码、凭据访问、审批篡改、动态模块加载(high);静态模块加载、进程信号、文件系统、网络、全局设置、沙箱、工具干预、会话读取(medium);普通 env 读取、定时器(low)。
  • 凭据形态环境变量:process.env.X 名字形如 *_KEY/_TOKEN/_SECRET/_PASSWORD/_CREDENTIAL/_AUTH/_COOKIE/_PRIVATE 单独记 high。
  • Client 规则:document.cookieinnerHTML XSS、浏览器 eval、动态模块加载(high);import()/require、存储、网络、跳转、postMessage、Service Worker(medium);host.call、定时器(low)。
  • 15 项服务能力面:ctx.get('shell'/'subprocess'/'credentials'/'approval'/'dynamicCordisRunner'/...) 精确检测。
  • 组合规则(收敛后):凭据形态数据+网络 = critical;Cookie+网络 = critical;文件读取+网络 = high;动态代码+网络 = high;本地存储+网络 = low(信息性)。
  • 混淆检测:高熵长字符串、\x/\u 转义、atob

能力声明约定(可选)

cordis_definepurpose 末尾追加:

CAPABILITIES: spawn,network,env,fs

关键字:spawn exec module network env fs credentials approval shell subprocess runner settings sandbox sessions llm process eval vm proto storage cookie dom redirect postmessage serviceworker rpc timer obfs。声明覆盖的规则项计分减半(报告标 [已声明])。

跨会话批准持久化

  • 人工批准的 ASK 成功执行后,其代码指纹(host+client 的 sha256)写入 <DSH_HOME>/storages/plugin-security-gate/state.json
  • 后续 define/run 命中相同指纹自动放行;代码变更即失效。历史尾部一并持久化。

profile bundle 库存审计

plugin_security_audit includeBundles=true:扫描 <DSH_HOME>/profiles/* 下声明 dsh 的依赖(@deepseek-ai/* 官方包跳过),读取入口产物做同一套静态审查,输出逐包判定。信息性审计:bundle 安装(pnpm/npm)不经过 cordis_define/cordis_run,守卫无法在该路径硬拦截,仅提供装前/装后可见性。

工具

  • plugin_security_review:对给定 host/client 源码做安装前审查,返回判定、评分、逐条风险与行号;purpose 支持 CAPABILITIES: 声明。
  • plugin_security_audit:指定 pluginId+packageId 出完整报告;无参数出全量总览+拦截/放行历史+守卫状态;includeBundles=true 附加 profile 库存审计。

维护与边界

  • 升级守卫(静态):dsh plugin --profile web update dsh-plugin-security-review;本地 file: 依赖更新后重跑一次 dsh plugin add
  • 自我保护边界:静态 bundle 守卫无法通过 cordis_stop/cordis_undefine 停用(它不在动态注册表里),但可由有文件权限的操作者经 dsh plugin remove 卸载——这是静态形态与动态形态的固有差异。
  • 已知限制:组合判定是静态 presence 判定,未经数据流确认,可能误报/漏报;深度混淆存在盲区;本守卫是进程内拦截(标准安装路径),不是对抗可停用守卫的恶意 actor 的安全边界,真正的纵深防御仍需宿主级隔离。

Project files and signals

Shown items are public repository signals detected in the directory snapshot.

Plugin manifestDetected
TestsDetected

Repository information

Language
JavaScript
License
MIT
Latest release
v1.5.0
Last updated
Aug 15, 2026, 4:48 PM

Install deliberately

Review source code, permissions, lifecycle hooks, dependencies and network access. Test untrusted plugins in an isolated environment.