Drifter-yh/dsh-tool-policy ↗★ 1
dsh-tool-policy
Declarative, fail-closed tool-call policy for DeepSeek Harness
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.