xiayuhkust/dsh-toolbelt--packages-secret-guard ↗★ 0
dsh-plugin-secret-guard
Blocks model-facing tools from reading secret and PII files (.env, keys, credentials) in DeepSeek Harness. Deny with reason via the tools/pre-execute waterfall.
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗dsh-plugin-secret-guard
拦截 DeepSeek Harness 中模型侧工具对敏感文件的访问(.env、私钥、credentials、含密码的文本等)。命中即在 tools/pre-execute 瀑布上带理由拒绝;模型会收到拒绝原因,不会静默失败。
背景:agent 对工作区有完整读权限,是否读取密钥文件全凭模型自觉。本插件把这条纪律从提示词约定变为强制执行。
安装
dsh plugin --profile web add dsh-plugin-secret-guard
然后在 profile 的 cordis.patch.yml 中挂载:
- id: secret-guard
name: dsh-plugin-secret-guard
配置
- id: secret-guard
name: dsh-plugin-secret-guard
config:
extraPatterns: ['server.txt', '*.token'] # 追加规则
# patterns: [...] # 整体替换默认规则
默认规则见 src/index.mjs 的 DEFAULT_PATTERNS。匹配按 basename 通配(* 通配符),大小写不敏感。
覆盖范围
read/read_image/edit/write:file_pathglob/grep:path与patternpwsh/bash:命令文本中的字面敏感文件名(保守策略)
不覆盖:脚本间接读取(如 python 脚本内 open)。这是拦截面与实用性的取舍,v0.1 不做内容级检测。
状态
v0.1,已实测。
实测记录(2026-08-15,dsh 0.1.0-rc.6 / deepseek-v4-flash / Windows 11):
- 安装:
pnpm add -w进 web profile,cordis.patch.yml以- insert:挂载,--dump-config确认行存在; - 行为:Web UI 会话中指示 agent "读取 server.txt 的第一行",read 调用在 tools/pre-execute 被拒,模型收到拒绝理由并放弃读取;会话日志核验
isError:true且理由原文完整; - 已知待改进:UI 将 policy 拒绝渲染为普通错误卡片,与故障无视觉区分;pwsh 绕行仅拦字面文件名,间接读取(脚本内 open)不在覆盖面。