Skip to content

ci: GitHub Actions のアクションを SHA 固定 + go-lint へ整理(CIサプライチェーン保護)#388

Open
taminororo wants to merge 3 commits into
developfrom
ci/kanba/387-pin-actions-sha
Open

ci: GitHub Actions のアクションを SHA 固定 + go-lint へ整理(CIサプライチェーン保護)#388
taminororo wants to merge 3 commits into
developfrom
ci/kanba/387-pin-actions-sha

Conversation

@taminororo

@taminororo taminororo commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Close #387

やったこと

CI のサプライチェーン保護として、(1) 両ワークフローのアクションをコミット SHA に固定し、(2) go-lint の checkout で資格情報の永続化を無効化、(3) 固定 SHA が塩漬けになる逆リスクを Dependabot の自動更新で解消する。あわせてワークフロー名を go-lint に整理した。

コミットは関心事ごとに分割している。

commit 1: SHA固定 + persist-credentials(#387 本体)
commit 2: ワークフローを go-lint にリネーム(命名整理)
commit 3: Dependabot 導入(固定SHAの自動更新)

SHA 固定の内訳(タグ → コミットSHA)

gh api repos/<repo>/commits/<tag> でタグが指すコミットを解決して固定。各行にバージョンコメントを併記した。

go-lint.yml
  actions/checkout              @v4 → 34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
  actions/setup-go              @v5 → 40f1582b2485089dde7abd97c1529aa768e1baff # v5
  golangci/golangci-lint-action @v7 → 9fae48acfc02a90574d7c304a1758ef9895495fa # v7

flutter-lint.yml
  actions/checkout              @v4 → 34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
  subosito/flutter-action       @v2 → 1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0

加えて go-lint.yml の checkout に persist-credentials: false を追加(flutter-lint 側は #386 で対応済み)。

Dependabot(固定の塩漬け対策)

SHA 固定は「タグ乗っ取りの自動実行」を防ぐ一方、固定 SHA が古いまま脆弱性修正を取りこぼす逆リスクがある。これを自動更新で解消する。Renovate は未インストール(GitHub Apps 一覧に無し)のため、GitHub ネイティブで追加インストール不要な Dependabot を採用した。

.github/dependabot.yml
  package-ecosystem: github-actions(.github/workflows を走査)
  schedule: weekly(更新が無ければ PR は出ない。確認頻度の指定)
  groups: 全アクション更新を1 PR に集約
  cooldown: 公開から7日経った版のみ対象(出たて版/乗っ取り直後の悪意版を避ける)
  commit-message.prefix: ci

検証

- 各 SHA は gh api でタグから解決した実在コミット
- go-lint.yml / flutter-lint.yml / dependabot.yml ともに YAML 構文 valid
- 挙動を保つため、メジャー更新(checkout v5/v7 等)はせず現行メジャーの SHA に固定。
  今後のメジャー更新は Dependabot のレビュー可能な PR 経由で行う

この PR は .github/ のみの変更で api/**mobile/** も触らないため、両ワークフローは本 PR 上では発火しない(self-trigger しない)。実 CI での発火確認は、マージ後に api / mobile を変更する次の PR で行われる。Dependabot の初回稼働もマージ後。

  - go-lint.yml / flutter-lint.yml の uses を SHA化
  - go-lint.yml checkout に persist-credentials 追加
  - lint.yml → go-lint.yml、name: lint → go-lint
@taminororo taminororo added 🔨改修 改修。バグ修正とはちょっと違うけど完全に新規作成でもないやつとか Size-XS 開発時間の目安は3時間以下 labels Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

GitHub Actions の lint ワークフローで、Flutter と Go の action 参照がコミット SHA 固定に置き換わりました。Go ワークフローは name が go-lint に更新されています。

Changes

CI ワークフロー更新

Layer / File(s) Summary
Go lint name and action pins
.github/workflows/go-lint.yml
ワークフロー名が lint から go-lint に変更され、actions/checkoutactions/setup-gogolangci/golangci-lint-action が固定 SHA 参照になった。
Flutter lint action pins
.github/workflows/flutter-lint.yml
actions/checkoutsubosito/flutter-action の参照がタグ指定から固定 SHA 参照に変更された。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • NUTFes/SeeFT#386: flutter-lint ワークフローを追加した PR で、今回の actions/checkoutsubosito/flutter-action の SHA 固定と直接つながる。

Poem

ぴょんぴょん、SHA で CI を結んで
うさぎの耳も安心ぴくぴく
Flutter も Go も、月明かりの道
ぶれない参照で、lint はまっすぐ
きらりと走れ、SeeFT の丘へ 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning lintgo-lint のリネームは issue #387 の必須要件外で、SHA固定とは別の変更です。 別PRに分けるか、issue側に命名変更も含める旨を明記してください。
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed SHA固定と go-lint への整理という主要変更を適切に要約しており、内容も変更点と一致しています。
Linked Issues check ✅ Passed SHA固定、persist-credentials無効化、バージョンコメント併記が両ワークフローに反映され、#387 の要件を満たしています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed Issue、概要、SHA固定の内訳、Dependabot、検証まで具体的に書かれており、テンプレートの主要項目を概ね満たしています。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/kanba/387-pin-actions-sha

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size-XS 開発時間の目安は3時間以下 🔨改修 改修。バグ修正とはちょっと違うけど完全に新規作成でもないやつとか

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[設定] GitHub Actions のアクションをコミットSHAに固定 + lint.yml の persist-credentials 無効化(CIサプライチェーン保護)

1 participant