Repository navigation
ci: pin actions, isolate the reviewer and lint workflows for security - #621
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
whes1015
force-pushed
the
ci/harden-workflows
branch
from
October 16, 2026 18:19
e523141 to
d89345d
Compare
This was referenced Oct 16, 2026
Member
Author
|
Force-push:rebase 到目前的 main( 和 main 及其他 PR 的衝突都是兩邊各自新增的內容,雙方都保留;ARB 在檔尾補逗號後重新產生 l10n。每一層都單獨跑過 analyze 和完整測試,頂端跑過 唯一有實質修改的是「pass build values to scripts through the environment」這個 commit:#620 新增的 |
whes1015
added this pull request to stack #626
October 16, 2026 19:21
whes1015
force-pushed
the
ci/harden-workflows
branch
from
October 16, 2026 19:31
d89345d to
54e97e0
Compare
Member
Author
whes1015
force-pushed
the
ci/harden-workflows
branch
from
October 16, 2026 19:37
54e97e0 to
81ac7d9
Compare
Member
Author
whes1015
force-pushed
the
ci/harden-workflows
branch
2 times, most recently
from
October 16, 2026 19:48
e184fc2 to
4944f11
Compare
whes1015
force-pushed
the
ci/harden-workflows
branch
from
October 16, 2026 19:53
4944f11 to
b034964
Compare
Member
Author
whes1015
force-pushed
the
ci/harden-workflows
branch
from
October 16, 2026 20:24
b034964 to
2546891
Compare
Member
Author
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.
這個 PR 做了什麼
收緊 GitHub Actions 的供應鏈與權限:所有 action 改釘 commit SHA、
review.yml在帶 secrets 的環境裡不再跑任何 PR 能控制的東西、actionlint 不再從main用curl | bash執行,並新增 workflow 安全檢查(zizmor)、Dependabot、套件 import lint 和DateTime.now()gate。另外修正三處和程式碼不符的文件。改動內容
CI/workflow
c1cfa263所有 action 改釘完整 commit SHA,後面附# vX.Y.Z(用gh api解析 tag,annotated tag 追到 commit)。原本的@v5這類 tag 可以被移動。1f0f22c9Dependabot:只管 GitHub Actions,每週一次、7 天冷卻期(避免剛發布就被竄改的版本立刻被拉進來),合成一個 PR。Signed-off-by: dependabot[bot],會被tool/check/commits.sh擋下,審查者要用自己的名義重新 commit。檔案裡有寫。80c27b67review.yml不再執行 PR 能控制的任何東西pull_request_target(有 secrets)底下跑alibaba/open-code-review@main。現在釘在 v1.12.13,它安裝的 npm CLI 也用ocr_version: 1.12.13釘住;不釘的話會裝latest,action 釘了也沒用。contents: read、pull-requests: write(和原本相同)。env;加上威脅模型說明:只 checkout base、只抓 head 的 git 物件,不執行 PR 的程式碼。d9db2096actionlint 改成固定版本並驗證 checksumtool/internal/pinned_tool.sh下載 actionlint 1.7.12 和 zizmor 1.30.1,比對每個壓縮檔的 SHA-256,不符就拒絕(已測)。執行檔放在.git/dpip-tools。tool/check/workflows.sh用和原本相同的-shellcheck=參數執行,CI 和tool/check.sh都跑。92523e13不推送的 job 不把 token 留在.git/config(persist-credentials: false);只有發布 job 需要推 tag 而保留。b290b7f7release.yml每個 job 只拿用得到的權限:workflow 預設無;version與build只能讀;publish可寫(推 tag、建 release)。buildjob 不再拿可寫的 token。b2bcf370release.yml的建置值改走環境變數,不再用${{ }}直接貼進 script。secrets 刻意不放進 Build 步驟的環境,讓建置相依讀不到。DPIP_PRERELEASE也一起改走RELEASE_PRERELEASE,feat(diagnostics): crash and startup reports from snapshot builds #620 檢查這一行的測試跟著更新。d2901118新增 workflow 安全檢查:tool/check/workflow_security.sh離線跑 zizmor,CI 和本機都跑。main/tag 自己存的快取會被還原,PR 的快取不會進到這個 job。唯一例外是review.yml以main範圍代 PR 執行,這個風險由它的版本釘選控制。71a0eff4開啟always_use_package_imports:lib/沒有違規,layering.sh的註解跟著更新。vendor 的third_party/meshtastic_flutter(產生的 protobuf 程式碼)有自己的analysis_options.yaml,繼承根目錄規則但排除這一條。2546891fDateTime.now()gate:tool/check/wall_clock.sh找出lib/裡沒有// wall-clock: <理由>標記的呼叫,CI 和tool/check.sh(有快取)都跑;13 個測試在test/tool/wall_clock_gate_test.dart。既有 24 個呼叫都標上具體理由。文件
acd378bdARCHITECTURE.md 的推播章節照程式碼重寫(傳輸是awesome_notifications_fcm,不是firebase_messaging),notification_service.dart裡相同的過時說明一起改。AppDelegate.swift的註解改成實際接手通知 delegate 的 awesome_notifications(已從原始碼確認)。b486504e拿掉 reporter 文件裡從沒實作過的「四分之一抽籤」,測試註解一起改。相關 issue
沒有對應的 issue。
怎麼驗
tool/commit.sh --push通過:analyze、codegen、全部 Dart 測試、actionlint、zizmor、新的 wall-clock gate。release.yml的權限與環境變數改動只有實際跑 release 才驗得到。需要在 repo 設定裡做的:
dependabot.yml進到main後自動開始,不用另外開。ocr_version要手動跟著改,Dependabot 看不到那一行。ci.yml的git fetch現在不帶憑證,因為 repo 是公開的;如果改成私有,要把憑證加回去。pinned_tool.sh裡的四個 checksum。zizmor 選 1.30.1 而不是 1.31.0,因為後者只發布一天,不符合 7 天冷卻。另外發現的:
lib/features/earthquake/data/monitor_demo.dart第 61、81、117、139、254 行的 debug 示範時間戳應該用AppTime(在時鐘錯誤的手機上,示範倒數會偏差同樣的量)。這個 PR 只標記,不改行為。檢查清單
tool/check/commits.sh通過tool/commit.sh --push)