前言¶
在 DeepSeek Harness(DSH)裏,智能體調用外部服務時常常需要憑證。直接讓模型持有 secret value,容易把密鑰帶入上下文、命令或 transcript。
下面介紹 accpowered/dsh-credential-manager。它的思路是讓模型按引用使用憑證:模型看到憑證名和 DSH_CM_<ID> 變量,secret value 不進入對話。
這是什麼¶
accpowered/dsh-credential-manager 是 accpowered 維護的 DSH 插件,採用 MIT license。
它爲 DSH 提供 named user credentials,主要包含三類能力:
- model-facing credential tools:
credential_list、credential_create、credential_read、credential_update_note - host service plugin:管理 credential metadata,並提供 secret value access behind the
ctx.credentialsseam - web client plugin:提供 Settings → Credentials 頁面,用於輸入和管理 write-only secret values
核心功能¶
- secret 值以
DSH_CM_<ID>環境變量的形式提供給 shell 使用。注入發生在每個 model shell execution。 - secret values 是 write-only,不會讀回任何頁面或 transcript。
- 過期憑證仍可工作;expiry 是 informational,並會標記在頁面和
credential_list中。 credential_read只作爲 deliberate last-resort escape hatch for non-shell use,不是默認使用路徑。
安裝¶
先執行安裝命令:
dsh plugin --profile web add github:accpowered/dsh-credential-manager
如果安裝過程出現 pnpm allowBuilds 提示,只允許可信來源,並考慮固定 commit。
插件會以當前 dsh 進程權限運行,因此安裝前應檢查源碼與許可證。
典型用法¶
1、先創建佔位憑證。模型調用 credential_create 時只傳 credential name,不傳 secret value。
2、再到 Settings → Credentials 頁面輸入 secret value。這個值是 write-only,之後不會讀回頁面或 transcript。
3、在 bash 或 pwsh 命令中使用 DSH_CM_<ID>。例如:
curl -H "Authorization: Bearer $DSH_CM_MYAPI" <your-endpoint>
這一步只讓命令拿到環境變量展開後的值,不把 secret 寫入對話。
4、如果確實需要非 shell 路徑,再考慮 credential_read。它只是 last-resort escape hatch,優先使用 DSH_CM_<ID>。
注意¶
credential_read不應作爲默認路徑。- 過期憑證不會自動失效,只在頁面和
credential_list中標記,便於提示輪換。 - 如果 harness 不轉發
credential-manager/updated事件,Settings → Credentials 頁面可能收不到來自其他 surfaces 的 live push invalidations。 - 卸載不會刪除已持久化的 metadata rows 和 stored secret values。
卸載時使用:
dsh plugin --profile web remove dsh-credential-manager
結尾¶
經過上面的安裝和用法,accpowered/dsh-credential-manager 把“模型能用憑證”和“secret 明文暴露”分開:模型使用名字和 DSH_CM_<ID>,人負責在 Settings → Credentials 中維護真實 secret。
GitHub:https://github.com/accpowered/dsh-credential-manager