chore: harden CI/CD against supply-chain attacks#164
Conversation
- Pin all GitHub Actions to commit SHAs (third-party + official) - Pin Bun to 1.3.14 and Node to 24 (was: latest/20) - Add bun install --frozen-lockfile to all install steps - Default workflow GITHUB_TOKEN to contents: read; opt-in to write per job - Add Dependency Review action to PR checks (fails on high severity) - Add Dependabot config for github-actions and npm (root + 3 packages) Mitigates: tj-actions/changed-files style tag-rewrite attacks, shai-hulud-style malicious dep injection via lockfile drift, over-privileged tokens leaking via compromised actions.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGitHub リポジトリの CI/CD パイプラインをサプライチェーン攻撃に対して強化。Dependabot で GitHub Actions と npm 依存の自動週次更新を設定し、6 個のワークフロー全体で Actions を commit SHA に固定、デフォルト権限を読み取り専用化、Bun 依存の frozen-lockfile 強制実行、Node.js バージョンを 24 に昇格。 ChangesCI/CD サプライチェーン攻撃対策
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/docs.yml (1)
50-50: ⚡ Quick winBun バージョンを環境変数として定義することを検討してください。
ci.ymlではenv.BUN_VERSIONを使用していますが、このワークフローでは Bun バージョンがハードコードされています。一貫性を保ち、メンテナンス性を向上させるため、このワークフローにもBUN_VERSION環境変数を追加し、bun-version: ${{ env.BUN_VERSION }}を使用することを推奨します。♻️ 提案される修正
ファイル上部の
on:セクションの後に env セクションを追加:on: push: branches: [main] ... workflow_dispatch: +env: + BUN_VERSION: "1.3.14" + # Sets permissions of the GITHUB_TOKEN...そして、setup-bun ステップを更新:
- name: Setup Bun uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: "1.3.14" + bun-version: ${{ env.BUN_VERSION }}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/docs.yml at line 50, The workflow hardcodes bun-version: "1.3.14"; add an env variable BUN_VERSION at the top-level workflow env (set to the same version or use existing env.BUN_VERSION) and update the setup-bun step to use bun-version: ${{ env.BUN_VERSION }}; ensure references to env.BUN_VERSION (and the setup-bun step name) are consistent so the workflow uses the environment variable instead of the literal string..github/dependabot.yml (1)
94-94: 💤 Low valueファイル末尾に改行を追加することを検討してください。
POSIX テキストファイルの慣例に従い、ファイル末尾には改行を含めることが推奨されます。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/dependabot.yml at line 94, dependabot 設定ファイルの末尾に改行がないため POSIX 準拠にする必要があります; 対象ファイル(dependabot 設定ファイル)の終端に改行文字を1つ追加してファイルを保存し、必ずテキストエディタやコミット時に改行が維持されることを確認してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/dependabot.yml:
- Line 94: dependabot 設定ファイルの末尾に改行がないため POSIX 準拠にする必要があります; 対象ファイル(dependabot
設定ファイル)の終端に改行文字を1つ追加してファイルを保存し、必ずテキストエディタやコミット時に改行が維持されることを確認してください。
In @.github/workflows/docs.yml:
- Line 50: The workflow hardcodes bun-version: "1.3.14"; add an env variable
BUN_VERSION at the top-level workflow env (set to the same version or use
existing env.BUN_VERSION) and update the setup-bun step to use bun-version: ${{
env.BUN_VERSION }}; ensure references to env.BUN_VERSION (and the setup-bun step
name) are consistent so the workflow uses the environment variable instead of
the literal string.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9697f4c4-2dd8-4d33-880d-265a41549037
📒 Files selected for processing (7)
.github/dependabot.yml.github/workflows/auto-tag.yml.github/workflows/ci.yml.github/workflows/close-issues.yml.github/workflows/docs.yml.github/workflows/release.yml.github/workflows/sync-dev.yml
Address CodeRabbit nitpick: hoist Bun version to env.BUN_VERSION in docs.yml for consistency with ci.yml. Skipped: trailing-newline nitpick on dependabot.yml — file already ends with LF (verified via wc -l / tail -c).
|
@coderabbitai レビューありがとうございます。Nitpick 2 件のうち 1 件を対応しました。 ✅ Fixed
⏭️ Skipped (false positive)
|
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
Closes #162
Summary
直近で連続している supply-chain 攻撃(
tj-actions/changed-filesの compromise、shai-huludnpm worm、nx/chalk/debugの悪性版配布など)に対する CI/CD 側の防御を導入。Changes
.github/workflows/*.ymloven-sh/setup-bun→0c5077e5...(v2.2.0)softprops/action-gh-release→3bb12739...(v2.6.2)actions/checkout→de0fac2e...(v6.0.0)setup-node/github-script/configure-pages/upload-pages-artifact/deploy-pagesも SHA 固定latest廃止)bun install --frozen-lockfileを CI の全 install step で強制GITHUB_TOKEN既定権限をcontents: readに変更し、release/tag job のみcontents: writeを opt-infail-on-severity: high)pull_request: [main, dev]両方でトリガーするよう拡張.github/dependabot.yml(新規)github-actionsecosystem を週次更新(pinned SHA の追従用)npmecosystem を root / backend / frontend / shared の 4 ディレクトリで週次更新Out of scope (next phase)
Test plan
Risk
bun-version: latestから固定したので、Bun の新バージョンが出るたび手動 bump が必要(Dependabot は Bun runtime には対応していないため、BUN_VERSION環境変数を手動更新で運用)v6/v2などの tag rewrite による「便利な自動更新」は無くなる代わりに Dependabot PR ベース運用になるSummary by CodeRabbit
リリースノート