CI 分界改成「會不會影響 correctness」:Gitleaks 掛回 PR - #39
Merged
Conversation
裁示 2026-08-16。兩組驗證回答的是不同的問題——integration/e2e 問「這個 PR 合進去會不會真的壞」,掃描問「現在這份 main 有沒有已知安全問題」。第二種 問的是現況,所以不必卡在每個 PR 上。 但 Gitleaks 不屬於第二種。判準是漏到 main 之後要付什麼:CodeQL/govulncheck/ Trivy 找到的東西修程式就結束了;一個憑證進了 main 就進了 git 歷史,刪掉不會 讓它失效,必須輪替。那一段不是 CI 省得下來的東西。 作法是把閘門下移:ci.yml 的 security job 不再帶 if(帶在那裡會把 Gitleaks 一起關掉),改由 security.yml 的 codeql/govulncheck/trivy 各自帶 if: github.event_name != pull_request。Gitleaks 那個 job 刻意沒有。 刻意不把 Gitleaks 搬成獨立 workflow:那會把檢查名稱從「安全掃描 / Gitleaks」 變成「Gitleaks / Gitleaks」,而分支保護是按名字釘的。security.yml 的 on: 註解早就記著這個代價。閘門下移拿到相同行為且一個字都沒改到名稱。 順帶:「重型」這個詞退休,改叫環境相依的完整驗證。它是照「要起幾個真東西」 取的名字,而那從來不是判準——實測 1.5~6.5 分鐘,比安全掃描便宜。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
裁示(2026-08-16)。組織的十五個倉庫同名分支各一條。
改了什麼
Gitleaks 掛回 PR,其餘掃描(CodeQL/Trivy)留在
main與手動。判準是「漏到
main之後要付什麼」:前者在 PR 攔下與在
main攔下代價一樣,所以放main是純賺的(省下每個 PR 數分鐘);Gitleaks 是唯一兩者代價不同的,
而差的那一段是找人去輪替憑證——那不是 CI 省得下來的東西。
作法:閘門下移,不動檢查名稱
ci.yml的securityjob 拿掉if:(留在那裡會把 Gitleaks 一起關掉)security.yml的codeql/trivy各自帶if: github.event_name != 'pull_request'能這樣做的前提:被
ci.yml呼叫時,security.yml讀到的github.event_name是呼叫端的事件。
驗證
ci.yml的security無if:;security.yml的掃描有閘門、gitleaks 沒有」
一件要知道的
「required」設不了:required status checks 是分支保護/ruleset 的設定,
不在倉庫檔案裡。本輪改的是「會不會跑」。