dsh-guardrail
DSH (DeepSeek Harness) security guard plugin: blocks/asks on dangerous commands & sensitive paths, redacts secrets in tool output, local JSONL audit log + guard_report. DSH 安全护栏插件。
同名包的其他仓库
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:darkmagic-ai/dsh-guard说明文档
阅读完整 README ↗配置
在网页 Plugins → dsh-guardrail 里改,或者写进 profile 配置。
| 配置项 | 默认值 | 说明 |
|---|---|---|
enabled | true | 总开关 |
dryRun | false | 演练模式:只写审计日志,不拦截、不脱敏 |
announce | true | 往系统提示里加一小段护栏说明(约 60 token) |
ignoreTools | ["guard_report"] | 这些工具不做拦截检查 |
commandArgKeys | 内置列表 | 哪些参数名算“命令文本” |
pathArgKeys | 内置列表 | 哪些参数名算“路径” |
disabledRules | [] | 要关掉的内置规则 id |
rules | [] | 自定义规则:{ id, kind: command|path, pattern, flags="i", action="ask", reason } |
allow | [] | 白名单正则,命中的参数不会触发拦截 |
redact.enabled | true | 是否给工具输出打码 |
redact.mode | content | content 只改模型看到的文本;value 改规范化后的 value(PTC 场景用) |
redact.disabled | [] | 要关掉的内置脱敏规则名 |
redact.emails | false | 给邮箱打码 |
redact.chileRut | false | 给智利 RUT 打码 |
redact.extra | [] | 自定义脱敏:{ name, pattern, flags="g", replacement="[REDACTED]" } |
audit.enabled | true | 写审计日志 |
audit.dir | "" | 日志目录,留空就用 $DSH_HOME/dsh-guard |
audit.logAllowed | true | 放行的调用也记下来 |
audit.logArgs | true | 记录参数预览(先脱敏再截断) |
audit.maxArgChars | 200 | 参数预览最多保留几个字符 |
没有审批通道时(比如 headless 运行),
ask会退化成拒绝,审计里记为unavailable。
Configuration
The keys and defaults are the same as in the Chinese table above. The ones you'll use most are dryRun (false), disabledRules ([]), allow ([]), rules ([]), redact.mode ("content"), redact.emails (false), audit.dir ("" → $DSH_HOME/dsh-guard) and audit.maxArgChars (200). Without an approval channel (headless), ask falls back to deny and is logged as unavailable.