dsh-auto-guard
DSH 自动防护插件:类似 Claude Code 自动模式的命令审批机制,在完全访问权限上增加 LLM 安全网。
AI 分析
核心用途是为 DSH 的高风险命令执行提供基于 LLM 的智能安全审批与过滤。适合开启了完全访问权限、需要防范恶意或误操作命令的安全敏感型用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Ayle5678/dsh-auto-guard说明文档
阅读完整 README ↗配置
- id: dsh-auto-guard
name: dsh-auto-guard
config:
rulesPath: '~/.dsh/auto-guard/rules.json'
defaultRulesPath: '~/.dsh/auto-guard/defaults.json'
cachePath: '~/.dsh/auto-guard/cache.json'
provider: 'deepseek'
model: 'deepseek-v4-flash'
reasoningEffort: 'off'
fallbackProvider: 'deepseek-official'
fallbackModel: 'deepseek-v4-flash'
timeoutMs: 3000
lowRiskTtlDays: 30
mediumRiskTtlDays: 7
onTimeout: 'deny' # deny | ask
notifyCacheHit: true
notifyLlmDecision: true
notifyAllow: 'page' # page | context | off
notifyDeny: 'context' # page | context | off
notifyAsk: 'context' # page | context | off
fileTrackerDefault: 'ask' # ask | deny
使用示例
普通复合命令
git status; git branch --show-current; git log --oneline -5
拆成子命令后,已白名单 / 已缓存的直接过;未匹配的子命令单独 LLM 审查,通过后进入缓存。
状态改变命令
export PATH=/tmp/evil:$PATH && ls
因为出现 export,整条命令交给 LLM 审查,不会因为 ls 在白名单里就直接放行。
目录删除
第一次执行:
rm -rf ./dist
会被拒绝并提示:
Directory deletion requires a reason. Reply with [删除理由] , then retry the same command.
重试时附带理由:
[删除理由] 清理构建产物
插件提取理由后,将“命令 + 理由”交给 reasoningEffort: high 的 LLM 复核;只有 allow 才放行,其余结果转人工确认。
- 注:虽然设计如此,但当前这部分还未调试好,多数情况下dsh+deepseek无法完成agent解释后的自动放行,可能需人工删除目录。