Drifter-yh/dsh-tool-policy ↗★ 1
dsh-tool-policy
声明式工具调用策略插件:为 DSH 提供默认拒绝、询问或允许的工具调用安全策略,支持基于工具名和参数的规则过滤。
AI 分析
核心用途是保障 DSH 运行环境的安全。适合担心 AI 执行高危操作(如 bash 执行 rm -rf)的用户,通过配置规则实现工具调用的安全拦截。
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Drifter-yh/dsh-tool-policy說明文件
閱讀完整 README ↗Configuration
defaultDecision: deny # deny (default), ask, or allow
rules:
# First matching rule wins.
- tool: 'bash'
decision: deny
reason: 'Destructive shell commands are disabled.'
argument:
path: /command
contains: 'rm -rf'
- tool: 'record.update'
decision: deny
reason: 'System records are immutable.'
argument:
path: /scope
equals: system
- tool: 'safe_*'
decision: allow
- tool: '*'
decision: ask
reason: 'Unlisted tools require approval.'
tool is an anchored name pattern with one wildcard, *. Other regular-expression metacharacters are treated literally. argument.path is an RFC 6901 JSON Pointer into parsed tool arguments. A condition uses exactly one of equals (JSON scalar equality) or contains (non-empty substring on a string). Rule order is explicit and deterministic.
Decision semantics:
denyreturns a normal Harness tool error before the body runs;askreturns{ kind: 'ask' }and letsctx.approvaldecide; without an approval channel Harness fails closed;allowcallsnext()and therefore does not override a prior or later policy listener;defaultDecisionapplies only when no rule matches.
Reasons never interpolate the call arguments. This avoids copying secrets or large payloads into model-visible approval feedback.