前言¶
在 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 维护。