ZhijiangTang/dsh-safeguard ↗★ 0
dsh-safeguard
DSH plugin: block dangerous shell commands and secret leakage before execution (tools/pre-execute veto)
AI 분석
核心用途是为 AI 智能体执行环境提供安全防护。适合担心 AI 误操作执行高危命令(如 rm -rf)或意外泄露敏感 API 密钥的安全敏感型用户。
설치
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ZhijiangTang/dsh-safeguard配置项
在 profile 的 cordis.patch.yml(或 bundle 配置)中覆盖:
- insert:
- id: guard
name: dsh-safeguard
config:
enableDanger: true # 危险命令拦截开关(默认 true)
enableSecrets: true # 密钥泄漏拦截开关(默认 true)
extraPatterns: # 额外正则字符串(额外危险命令规则)
- 'curl.*\|.*bash'
allowList: # 精确豁免名单(字符串完全一致才豁免)
- 'rm -rf /tmp/safe-dir'
| 配置项 | 类型 | 默认 | 说明 |
|---|---|---|---|
enableDanger | boolean | true | 是否拦截危险命令 |
enableSecrets | boolean | true | 是否拦截密钥泄漏 |
extraPatterns | string[] | [] | 额外危险命令正则(非法正则以警告跳过) |
allowList | string[] | [] | 精确豁免:危险命令按整条命令、密钥按命中片段做完全一致匹配 |