Drifter-yh/dsh-tool-policy1

dsh-tool-policy

Declarative, fail-closed tool-call policy for DeepSeek Harness

AI 분석

核心用途是保障 DSH 运行环境的安全。适合担心 AI 执行高危操作(如 bash 执行 rm -rf)的用户,通过配置规则实现工具调用的安全拦截。

패키지
dsh-tool-policy
버전
0.1.0
라이선스
MIT
최근 업데이트
2026. 8. 13.

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Drifter-yh/dsh-tool-policy

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:

  • deny returns a normal Harness tool error before the body runs;
  • ask returns { kind: 'ask' } and lets ctx.approval decide; without an approval channel Harness fails closed;
  • allow calls next() and therefore does not override a prior or later policy listener;
  • defaultDecision applies only when no rule matches.

Reasons never interpolate the call arguments. This avoids copying secrets or large payloads into model-visible approval feedback.