返回目錄

dsh-permission-rules

精選清單收錄維護狀態: 活躍

perrylink/dsh-permission-rules

Claude Code 風格宣告式許可權規則:按序 allow/deny/ask 匹配工具、引數與工作區路徑

前往 GitHub專案首頁
$ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"

140

星數

4

Fork

TypeScript

語言

Apache-2.0

授權條款

2026-08-13

建立於

2026-11-19

最近推送

Apache-2.0 的 dsh 外掛:以有序的 allow/deny/ask 規則攔截 DeepSeek Harness 的每一次工具呼叫,將判定記入工作階段日誌,並強制執行程序級網路原則——全部用 YAML 設定,支援熱重載。

DSH 整合

原生執行環境

作者聲明

安全稽核

未稽核

最後核實

2026-08-30

授權條款

Apache-2.0

01它能幫你完成什麼?

  • Gate every DeepSeek Harness tool call with an ordered allow / deny / ask permission policy written in plain YAML

    A deterministic, instant, auditable rule layer on the `tools/pre-execute` waterfall, with every hit and passthrough audit-logged as a `permissionRules/decision` session event

    DeepSeek Harness (dsh) operators who want Claude Code-style declarative safety guardrails without re-implementing the approval flow

  • Control shell subprocess network egress with a process-level network policy

    A built-in local HTTP/CONNECT proxy plus ordered network rules (deny-all / whitelist / allow-all / auto) that decide every outbound connection

    Teams that need Codex-style egress control and network-policy auditing inside DeepSeek Harness

02如何將外掛接入 DeepSeek Harness?

先決條件

  • DeepSeek Harness `0.1.1-rc.2` (or compatible) installed as the agent runtime
  • Node `^22.19.0 || >=24.0.0`

安裝步驟

  1. 01

    Install the bundle: `dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"`

    $ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"

  2. 02

    Or from npm (published releases): `dsh plugin --profile web add dsh-permission-rules`

    $ dsh plugin --profile web add dsh-permission-rules

  3. 03

    Restart and verify the row: `dsh --profile web --dump-config | grep -A4 'id: permission-rules'`

    $ dsh --profile web --dump-config | grep -A4 'id: permission-rules'

驗證整合成功

  • After restart, `dsh --profile web --dump-config | grep -A4 'id: permission-rules'` prints the permission-rules row
  • Run `/rules` to list the active rules, their source files, and any last-reload error

復原

  • Uninstall with `dsh plugin --profile web remove dsh-permission-rules`
  • Set `enforce: false` for a dry-run rollback: deny/ask hits are audit-logged with a `dryRun` marker and every call passes through

03DSH 整合程度與能力邊界

DSH 整合原生執行環境

Native dsh plugin — installs via `dsh plugin --profile web add`, then hooks the `tools/pre-execute` waterfall as a first-match allow/deny/ask listener.

  • Ordered allow / deny / ask rules on tools/pre-execute

    tool calls on the `tools/pre-execute` waterfall→first-match allow/deny/ask decision; `deny` makes the rule `reason` the model-visible error; `ask` rides the official approval seam

    Every hit and passthrough is audit-logged as a `permissionRules/decision` session event (log-only — nothing extra is injected into the model context)
  • Rich rule matching

    tool-name globs, agent-identity selectors, argument key/value globs or regexes, workspace-relative path globs, `when` host conditions, shell command decomposition→token-precise match across multiple dimensions

  • Process-level network policy + local proxy

    shell subprocess outbound connections→ordered network rules / deny-all / whitelist / allow-all / auto modes; denied connections audit to `permissionRules/network`

    Proxy environment variables are injected for subprocesses (`network.injectEnv`)A built-in local HTTP/CONNECT proxy binds `127.0.0.1`
  • Hot reload & fail-loud loading

    rule file edits→Chokidar watch with debounce reload; a broken edit keeps the previous rules, never crashes

    Invalid YAML, unknown actions/fields, bad globs/regexes, backtracking-prone patterns, or more than `maxRules` rules fail the load loudly

04適合誰?何時不該用?

適合

  • DeepSeek Harness (dsh) operators who want Claude Code-style declarative safety guardrails without re-implementing the approval flow
  • Teams that need Codex-style egress control and network-policy auditing inside DeepSeek Harness

不適合

  • On pre-marker harness hosts (the `0.1.0-rc.1`–`rc.7` and `0.1.1-rc.1`–`rc.7` lines) the `ignorable` marker is silently dropped and the runtime disables session-log audit with a one-time warning; set `allowUnmarkedAudit: true` to opt back in.

05相容性、維護與安全提醒

  • On pre-marker harness hosts (the `0.1.0-rc.1`–`rc.7` and `0.1.1-rc.1`–`rc.7` lines) the `ignorable` marker is silently dropped and the runtime disables session-log audit with a one-time warning; set `allowUnmarkedAudit: true` to opt back in.
  • Path candidates are heuristic: only the documented argument keys feed path matching, and workspace-relative matching is ASCII-case-insensitive only when `caseInsensitivePaths` is on. Globs are a conservative subset with no brace expansion.
  • `paths` candidates come only from a documented set of argument keys (depth-capped) and only workspace-relative paths match. OS-level sandbox policy belongs to the sandbox seam, not this plugin.
2026-08-132026-08-29v0.6.1

Apache-2.0 · actively maintained (latest release v0.6.1, 2026-08-27)

06常見問題

如何在 DeepSeek Harness 中安裝 dsh-permission-rules?

已發佈版本執行 `dsh plugin --profile web add dsh-permission-rules`;最新 main 分支執行 `dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"`。隨後重新執行並用 `dsh --profile web --dump-config | grep -A4 'id: permission-rules'` 驗證。

安裝前提與相容性是什麼?

需要 DeepSeek Harness `0.1.1-rc.2` 與 Node `^22.19.0 || >=24.0.0`。支援所有平台(宿主程序 + Web 設定客戶端),且適用任意模型,因為 deny/ask 的原因會透過工具結果回傳。

它如何與 DeepSeek Harness 連接 / 整合?

它是原生 dsh 外掛:註冊一個 `tools/pre-execute` 監聽器,使每次工具呼叫先經過其有序的 allow/deny/ask 規則。`ask` 判定走官方核准通道——掛載 `dsh-auto-review` 可由第二模型作答,或由人工作答——因此核准流程沒有任何重新實作。

它與 Claude Code 的權限或沙箱有何不同?

它風格類似 Claude Code,但作為原則層執行在 DeepSeek Harness 內部,而非核心。`paths` 候選只來自一組文件化的參數鍵,且只匹配工作區相對路徑;作業系統級沙箱原則仍由沙箱通道負責。它還提供程序級網路原則與內建本地代理,並復用 harness 自身的核准流程而非另起一套。

排障:稽核日誌遺失或規則未載入?

在 pre-marker harness 宿主(`0.1.0-rc.1`–`rc.7` 與 `0.1.1-rc.1`–`rc.7` 系列)上 `ignorable` 標記會被靜默丟棄,執行時會一次性告警並關閉工作階段日誌稽核;設定 `allowUnmarkedAudit: true` 可重新開啟。損壞的 YAML、未知欄位、錯誤的 glob/regex,或超出 `maxRules` 會保留舊規則(熱重載)或直接報錯載入失敗——執行 `/rules` 可查看最近一次重載錯誤。

08資料與來源

  • 作者聲明github.combb7735cddce9…

    Claude Code-style declarative permission rules for DeepSeek Harness.

  • 作者聲明github.combb7735cddce9…

    `dsh-permission-rules` puts an ordered **`allow` / `deny` / `ask`** rule list in front of every tool call on the `tools/…

此頁面根據專案公開文件、儲存庫中繼資料與 DSH Plugins 的結構化解析所產生;最後核實於 2026-08-30。發現錯誤?提交更正。

🏆

最佳 DeepSeek Harness 外掛

從全目錄挑出的 12 個值得優先安裝的外掛,涵蓋各個分類。

DSH Plugins 是獨立的 DeepSeek Harness 外掛目錄,與 DeepSeek 官方無關,也不代表官方背書。第三方外掛未經安全稽核,安裝前請審查原始碼。

每週取得最新的 DeepSeek Harness 外掛,絕不濫發。