前言¶
DSH 的插件機制把 profile、依賴聲明和 bundle 組織成可組合的能力。實際維護 profile 時,常見的問題是:聲明裏寫了什麼依賴,pnpm lock 裏鎖了什麼,安裝的包 manifest 裏又是什麼,以及每個包聲明的 dsh.bundle.patch 是否對得上。
dsh-profile-lock-proof 針對這個邊界,生成一份內容尋址、機器可讀的證明。它的範圍比 SBOM、CVE 掃描、簽名校驗或安裝器更窄:不執行包、不聯網、不修改 profile,也不返回 manifest、lockfile、patch、腳本命令或 secret 內容。
這是什麼¶
dsh-profile-lock-proof 是 dongsheng123132 維護的 DSH 插件,MIT 許可,要求 Node.js >=22,當前版本爲 0.2.0。
它提供一組 CLI 命令和 DSH/MCP 工具,用於檢查一份顯式 proof manifest 所描述的 profile 依賴聲明、pnpm lock importer、已安裝包 manifests 和 dsh.bundle.patch 是否一致。
0.2.0 移除了 bundled DSH tool runtime,以及被 stock Cordis Loader 誤分類的 default export;bundle 現在通過 namespace export 暴露 host-neutral tool definitions。
核心能力¶
證明內容¶
該插件生成機器可讀證明,覆蓋以下內容是否一致:
- DSH profile 依賴聲明
- pnpm lock importer
- 已安裝包 manifests
- 每個包聲明的
dsh.bundle.patch
依賴 specifier 只接受 exact semver 或 github:owner/repo#<40-hex-commit>。
輸入與失敗策略¶
插件對輸入證據採用 fail closed:
- 輸入路徑必須是 workspace-relative regular file,拒絕 traversal 和 symlinks。
- profile 和 lockfile 的 bytes 必須匹配顯式 proof manifest 中的 SHA-256 值。
- 會檢查 pnpm importer specifier、installed name/version/package hash、bundle patch path/hash,以及 lifecycle hooks 的缺失。
- 遇到 missing、stale、invalid、mutable、mismatched 或帶有 lifecycle script 的證據,會失敗。
輸出與權限¶
證明輸出只包含 identities、classifications、hashes、status 和 disclosure。報告會原子寫入顯式的 artifactDir,並讀回驗證。
插件不執行包、不訪問網絡、不修改 profile,也不返回 manifest、lockfile、patch、腳本命令或 secret 內容。
安裝與啓用¶
將插件安裝到一個獨立 profile,並固定 commit:
dsh plugin --profile profile-lock add github:dongsheng123132/dsh-profile-lock-proof#<commit>
<commit> 需要替換爲要使用的 40 位 commit。安裝前建議檢查源碼、許可證和入口文件;該插件以當前 dsh 進程權限運行。
典型用法¶
下面命令在 workspace 根目錄檢查一份 proof.json:
dsh-profile-lock-proof inspect --workspace . --manifest proof.json
inspect 用於 workspace proof checking。
dsh-profile-lock-proof verify --workspace . --manifest proof.json --artifactDir artifacts
verify 用於 verification,並允許把報告寫入顯式的 artifactDir。
退出碼含義:
0:驗證通過,得到 verified proof。2:verification 或輸入失敗。
MCP / DSH 工具¶
插件提供 DSH/MCP 工具:
dsh_profile_lock_inspectdsh_profile_lock_verify- MCP aliases:
profile_lock_inspect、profile_lock_verify
MCP 面權限更低:只接受 bounded inline evidence,不讀也不寫文件,並與 CLI 共享 validation core。DSH/CLI 面只能寫入顯式的 workspace-relative artifactDir,並且要求原子寫入和讀回驗證。
本地自檢¶
在插件源碼倉庫中,可以運行以下命令做本地驗證:
npm ci
npm test
npm run check
npm run smoke:plugin
npm run smoke:mcp
npm run smoke:web-loader # requires DSH_CHECKOUT and isolated DSH_HOME
適用場景與注意¶
適合以下使用:
- 需要證明某個 DSH profile 的依賴聲明、pnpm lock 和已安裝包之間一致。
- 需要在不執行包、不聯網、不返回敏感文件內容的前提下生成機器可讀證明。
- 需要在 workspace 中用固定 commit 安裝插件並複覈 bundle patch。
需要注意的是:
- 它不是 SBOM、CVE scanner、signature verifier 或 installer,只覆蓋上述一致性邊界。
- 輸入文件必須來自 workspace 內的 regular file;路徑越界、symlink、可變更或內容不匹配都會 fail closed。
- 插件以當前
dsh進程權限運行,安裝前應檢查源碼、許可證和工具行爲。
相關鏈接¶
- GitHub:https://github.com/dongsheng123132/dsh-profile-lock-proof
- 插件線索目錄頁:https://www.skillhub.cn/plugins/dongsheng123132/dsh-profile-lock-proof(目錄頁內容未覈實)