41c56acd32
跨 repo 交辦時(總管站在 A repo,要推 B repo 的 main)main-and-prod-push-guard 的戳記機制永遠對不上:HERE 讀的是 hook 自己的 cwd(=session 的真身,不會變), WANT 是總管替目標 repo(B)寫進戳記的路徑——兩者結構性地不可能相等,不是 判斷錯,是這個情境在舊模型裡根本不存在(inkstone/ISEP#30 comment 3949, 脈絡 inkstone/InkStoneCo#57,2026-08-21 實撞)。 新增 hooks/lib/push_target_dir.py:純 tokenize(不執行任何指令)解析指令裡 `cd <path> && git push` 或 `git -C <path> push` 真正會落地的目錄,對多層 cd 鏈與子殼(`(cd A && ...); git push` 這種子殼 cd 不能外洩出去)都做了範圍化—— 這條範圍化是防穿透的關鍵,不是順手:沒有它,`(cd A && true); git push` 會被誤判成推向 A,讓替 A 開的舊戳記錯誤地放行推到殼外真正的目標。解不出來 一律退回舊行為(hook 自己的 cwd),維持 fail-closed 方向不變。 順手修掉補測時自己抓到的另一個洞:`(git push origin HEAD:main)`——單純加一層 括號——舊版目的地判斷完全偵測不到,整段直接放行,跟戳記無關。成因是截斷 refspec 尾巴的 sed 只認 `;`/`&`/`|` 三種字元,沒算到 `)`;補上即可,git 的 refspec 語法本來就不允許出現 `)`,這裡截斷永遠安全。 綁 repo+單次用完即丟兩條 2026-08-11/12 用血換來的性質完全沒有鬆動:只是把 「現在人在哪個 repo」問得更準,比對邏輯一個字沒動。 實測: - hooks/tests/main-and-prod-push-guard.test.sh 舊有 8 向:8/8 - scripts/test-main-and-prod-push-guard.sh 舊有 11 向:11/11 - 新增 hooks/tests/main-and-prod-push-guard-cross-repo.test.sh 17 向 (跨 repo 正向/反向不准鬆/git -C/子殼範圍化/括號洞/單次用完即丟/ 900 秒逾時/空戳記/既有行為零回歸):17/17 本輪只驗證,未拿去放行任何真實推送;plugin.json 隨慣例 bump 0.3.4 -> 0.3.5 並重跑 vendor-to-shell.py(.shell-payload 為 gitignore 產物,不入版控)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
17 lines
519 B
JSON
17 lines
519 B
JSON
{
|
|
"name": "isep",
|
|
"description": "InkStone Environment Plugin —— leo 的 Claude Code 環境唯一真相源:43 支機械閘(53 條註冊,白話盤點見 docs/hooks-inventory.md)、7 支 slash command、2 支 skill、27 支腳本,外加治理規範與標籤真相源。本機與雲端裝同一份,沒有子集。",
|
|
"version": "0.3.5",
|
|
"keywords": [
|
|
"inkstone",
|
|
"guardrails",
|
|
"hooks",
|
|
"gitea",
|
|
"arcrun"
|
|
],
|
|
"author": {
|
|
"name": "Leo",
|
|
"url": "https://uncle6.me"
|
|
}
|
|
}
|