前言¶
在 DeepSeek Harness(DSH)裏跑無頭智能體時,PR 門禁可能被繞過;聊天界面展示的往往是模型「聲稱」做過什麼,而不是工具層真實執行結果。社區裏已有插件負責「讀了什麼」(如 dsh-read-guard)、「寫了什麼」(如 dsh-pr-gate),但截至資料所述時間點,DSH 插件生態裏仍缺少對「實際做了什麼」的防篡改、可離線校驗的存證鏈。下面介紹維護者 zhengqiuyang 發佈的 dsh-attest-chain(分類:admin-security),它把被監聽的工具結果寫入 hash 鏈式、ed25519 簽名的 JSONL 賬本,並可將 shell 輸出中的 commit SHA 綁定進鏈。
這是什麼¶
dsh-attest-chain 面向 DeepSeek Harness 會話,提供 Signed chain-of-custody:對被監聽工具(如 bash、write、edit、web_fetch 等)的每次結果追加一條 custody record,經 SHA-256 鏈接並可選 ed25519 簽名後追加到持久化賬本。信任路徑上不調用 LLM;篡改任意一行會使鏈斷裂,截斷尾部則與已發佈的 head 不一致。簽名核心 vendored 自 agent-attest,其 CI 門控可將該賬本作爲會話側證據消費。
與同屬安全方向的 qiushi-dsh-evidence-audit 相比:本插件在 SHA-256 鏈之外對每條記錄做 ed25519 簽名,記錄綁定模型可見內容的 sha256、工具名、callId、錯誤標誌,並從 shell 輸出提取 commit SHA 做 Git 綁定;校驗 API verifyChain() 可返回首個壞鏈位置 {seq, reason}。若只需最小 footprint、零密鑰材料,資料建議選 qiushi;若需要歸因與倉庫歷史綁定,選 attest-chain。
工作原理¶
資料中的數據流如下:
tool result ──> custody record {time, tool, callId, isError, sha256(content)}
──> chained: digest = sha256(canonicalJSON({seq, prevDigest, record}))
──> signed: ed25519 over the digest (keypair in .dsh-attest-chain/keys/)
──> appended: .dsh-attest-chain/session.jsonl (one line, strict order)
校驗爲純離線:重放賬本、重算 digest、檢查鏈接與簽名。將 head digest 或公鑰發佈到 PR 描述、CI 變量等持久位置後,後續對比可確定性發現篡改或截斷。首次運行生成密鑰對,私鑰不離開運行智能體的機器;配置 sign: false 時僅做 digest 鏈,適合只需對已發佈 head 做篡改證據的場景。
安裝與啓用¶
官方安裝命令(npm 分發,無需 build、無需 allowBuilds 授權;倉庫內已帶預構建 lib/):
dsh plugin --profile default add dsh-attest-chain
兼容性說明(資料摘錄):已在 DSH 0.2.x 線驗證(源碼快照 0.2.1-alpha.2);Node >= 20。Disposable profile 下亦可用 dsh plugin --profile <fresh> add github:zhengqiuyang/dsh-attest-chain 安裝,啓動日誌會出現 [dsh-attest-chain] active: …。
在 DSH 配置中啓用並指定監聽工具與路徑,示例:
- id: dsh-attest-chain
name: dsh-attest-chain
config:
tools: [bash, write, edit, str_replace_editor, web_fetch]
ledgerPath: .dsh-attest-chain/session.jsonl
keysDir: .dsh-attest-chain/keys
sign: true
請將 .dsh-attest-chain/ 加入倉庫 .gitignore,私鑰不得提交;校驗方使用公鑰。插件以當前 dsh 進程權限運行,安裝前請自行審閱 GitHub 源碼 與 MIT 許可證(package.json 版本 0.1.0)。
典型用法與消費方式¶
- 按上文安裝並寫入
config,在需要存證的 profile 下正常跑會話;工具結果會自動追加到ledgerPath。 - 將會話結束時的 head digest 或公鑰寫入 PR、CI 等可對比的位置。
- 離線調用導出的
verifyChainAPI 重放賬本;dsh-trust-panel 可在側邊欄實時運行校驗並展示結果。
開發側自測(維護者倉庫):
npm install
npm test # syncs the vendored agent-attest core, builds, runs unit tests
路線圖(資料未承諾交付時間):會話結束 in-toto statement 封裝、按 session id 分賬本、Web UI 內 verify 工具卡、向 PR posting head digest 的 GitHub check-run 橋接。
適用場景與注意¶
適合:需要在事後證明「智能體會話中哪些工具結果被記錄、鏈是否完整、誰簽名」的團隊;希望與 agent-attest CI、dsh-trust-panel 串聯的 in-toto 形證據鏈;需要把 shell 輸出中的 commit 與工作鏈綁定的場景。
侷限(插件自述):observe-only;不能證明命令在 OS 層「正確執行」,也不能檢測「在賬本首次發佈之前」就被刪掉的尾部。與 qiushi 一樣,對邊界誠實。
安全:內容僅存 digest,不落明文;密鑰目錄在本地。社區插件目錄 SkillHub 爲獨立站點,與 DeepSeek / 幻方無官方從屬關係。
鏈接¶
- 目錄頁:https://www.skillhub.cn/plugins/zhengqiuyang/dsh-attest-chain
- 源碼與 README:https://github.com/zhengqiuyang/dsh-attest-chain
若 DSH 官方或主流插件後續內置同等能力的簽名會話記錄,維護者 README 中的 kill criteria 表明本插件將凍結在最後可用版本並在此留 postmortem;簽名核心仍由 agent-attest 維護。