Vai al contenuto principale
W

dsh-slowmist-security-guard

wjl906/dsh-slowmist-security-guard

Security guard for DeepSeek Harness (Cordis): reviews every tool call in pre-execute against SlowMist agent-security rules, denying or flagging risky commands, MCP servers and skill loads, external URLs and repositories, untrusted documents, and EVM or Solana addresses; scans tool results for prompt injection after execution and ships a slowmist_scan audit tool plus an injected security policy prompt. Rules follow the open-source SlowMist Agent Security Skill (MIT).

Installazione

dsh plugin --profile web add github:wjl906/dsh-slowmist-security-guard

README

dsh-slowmist-security-guard

DeepSeek Harness (Cordis) 安全插件 —— 将 slowmist-agent-security 的 Agent 安全审查流程接入 Harness 工具管线:在外部内容进入 Agent 执行路径时自动触发审查、输出风险报告、并按阈值阻断高风险调用。

审查触发面

触发点机制审查来源
外部 MCP 调用 (mcp__*)tools/pre-executereviews/skill-mcp.md
加载新 Skill / 安装插件与 bundle (skill、plugin_manager)tools/pre-executeskill-mcp.md + supply-chain.md
访问外部 URL(web_fetch、research、modlens_read_image)tools/pre-execute + tools/post-execute 内容注入扫描reviews/url-document.md
访问代码仓库(git clone、仓库 URL)tools/pre-executereviews/repository.md
接收外部文档(dsh_im_group_file 及抓取内容)tools/pre-execute + tools/post-executereviews/url-document.md
链上地址(EVM / BTC / TRON / Solana 出现在任意工具参数)tools/pre-executereviews/onchain.md
Shell 命令红线(bash / pwsh)tools.guard(单调硬阻断)patterns/red-flags.md + supply-chain.md

风险分级与决策

四级评级:🟢 LOW → 🟡 MEDIUM → 🔴 HIGH → ⛔ REJECT(与 slowmist skill 一致;多重攻击同现直接 REJECT)。

  • mode: "enforce"(默认):严重度 ≥ blockAt(默认 HIGH)的调用被 deny,完整风险报告作为拒绝理由回传给 Agent;MEDIUM 及以下放行并附审查报告(additionalContexts)。
  • mode: "report":只出报告,不阻断。
  • 硬红线(guard):curl|bash 管道执行、身份/记忆文件窃取、凭据外传、持久化注入、浏览器 Cookie 窃取等 supply-chain/身份类模式,无论阈值一律阻断(enforce 模式)。
  • HIGH/REJECT 的最终放行决策始终留给人:在插件配置中把对应域名/仓库/MCP/地址加入 allowlist(allowDomains / trustedRepos / trustedMcpServers / allowAddresses)即可放行。

按需扫描工具

插件注册 slowmist_scan 工具(target + 可选 kind: auto|url|repo|skill|onchain|command|document),Agent 或用户可对任意目标手动跑同一套审查流程,输出与自动拦截相同的报告。

配置(Config,schemastery)

mode、blockAt、guardShell、scanMcp/Skill/Url/Repo/Doc/Onchain、advisory、allowDomains、trustedMcpServers、trustedRepos、allowAddresses、blockAddresses、maxReportChars、scanTool。

安装

# 从 npm 安装(Harness 会话内,插件管理)
plugin_manager install_bundle dsh-slowmist-security-guard

也可在 dshmarket 可视化插件市场中搜索安装。安装后即刻生效(系统提示段落 + guard + 监听器随 profile 加载)。

本地开发 / 发布

# 本地目录直装(文件依赖,改代码后禁用→启用即可热重载)
plugin_manager install_bundle  target=<本仓库检出路径>

# 发布前自检:确认 tarball 只含 files 白名单里的文件
npm test
npm pack --dry-run

# 发布(需要 npm 账号)
npm login
npm publish

许可

MIT。审查清单/模式库/报告格式移植自 slowmist-agent-security(MIT,© SlowMist),出处已在 lib/engine.js、lib/prompt.js 与 LICENSE 保留。

文件结构

index.js          插件入口(导出 name/inject/Config/apply)
lib/engine.js     审查引擎:模式库(11 类红旗 / 8 类社工 / 7 类供应链)、
                  17 类提示注入向量、URL/仓库/链上地址解析、分级与报告渲染
lib/prompt.js     系统提示中的安全策略段落(slowmist 通用原则 + 触发表)
tests/            引擎与加载测试(npm test,41 项断言)
locale/*.json     展示元数据(en/zh)
icon.svg          插件图标
cordis.patch.yml  bundle patch(- insert)

Plugin correlati