guardrails: run the content scan's secret and machine-path checks through gitleaks to fit the 3 s hook ceiling
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 54/100
研究方向
Read plugins/guardrails/git-hooks/content-scan.sh, lib/git-hooks/check-lib.sh, and the guardrails entries.json tool declarations; compare the existing secret and machine-path rules with the cases in plugins/guardrails/git-hooks/*.test.sh. Run the pre-commit and pre-push content tests, then use scripts/check-git-hook-time-budget.sh --force --sizes 120,2000,10000 on Windows Git Bash. Done means the tests retain their asserted behavior, both hooks meet the scaled 3 s budget at every size, and the exemption is removed.
由索引模型根據 Issue 內容生成。
描述
Context
The guardrails pre-commit and pre-push content scan (secrets plus machine-specific paths) is the one git-hook job over the owner's 3 s ceiling on very large changes, so under #20945 it is exempt from that ceiling. On 10 staged files of 10,000 lines (Windows Git Bash, hyperfine, 10 runs) plugins/guardrails/git-hooks/pre-commit-content.sh took 2061 ms; gitleaks git --staged took 327 ms on the same commit and reported a planted fake token. Its two largest costs in a sequential bash -x trace (2.610 s traced total) are shared changed-line work, checks_added_ranges awk in lib/git-hooks/check-lib.sh (0.635 s over two calls) and added_only awk in plugins/guardrails/git-hooks/content-scan.sh (0.245 s), which both its secret and machine-path checks use; the secret-only step is small, so swapping only the secret detector does not help. Decision record: #20945 (issuecomment-7398359436).
Proposed work
- Express the guardrails machine-path patterns and exemptions as gitleaks rules, so one native gitleaks pass covers secrets and machine paths on the staged (pre-commit) and pushed (pre-push) range.
- Keep today's findings: every case
plugins/guardrails/git-hooks/*.test.shcovers still blocks or passes the same way. - Declare gitleaks as a guardrails git-hook tool (entries.json
tools), with the missing-tool behavior the formatter PATH-probe checklist sets. - Then drop the content scan's exemption from the hook budget.
Acceptance criteria
bash plugins/guardrails/git-hooks/pre-commit-content.test.shandpre-push-content.test.shpass unchanged in what they assert.scripts/check-git-hook-time-budget.sh --forceon Windows Git Bash puts guardrails pre-commit and pre-push content at or under the scaled 3 s budget at every--sizesarm (120, 2000, 10000 lines).- The content scan's hook-budget exemption is removed.
References
- Part of #20945.
- 主要語言
- Shell
- 星號
- 22
- 分支
- 2
- 平均合併
- 3 小時 20 分鐘
- 30 天內合併 PR
- 956
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
melodic-software/claude-code-plugins 的其他 Issue
-
host-run needs-research
難度 2/5 1-3 小時 新手友好度 66/100
melodic-software/claude-code-plugins#21140 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
melodic-software/claude-code-plugins#21103 · 4 則留言 ·
維護者通常 1 天內回覆
-
host-run
難度 2/5 1-3 小時 新手友好度 72/100
melodic-software/claude-code-plugins#21053 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
melodic-software/claude-code-plugins#21021 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
melodic-software/claude-code-plugins#20960 · 5 則留言 ·
維護者通常 1 天內回覆
查看 melodic-software/claude-code-plugins 的全部 Issue
相似的 Issue
-
documentation enhancement
難度 2/5 1-3 小時 新手友好度 82/100
aws/aws-networking-best-practices#256 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 68/100
smores56/homelab-platform#289 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
omacom/omarchy#21787 · 3 則留言 ·
維護者通常 1 天內回覆