feat: repo-maintenance にサプライチェーン保護・本番リリース統制チェックを追加 - #580
Conversation
Actions SHA固定・権限制限、Push Protection、Dependency Review、 Deployment Environment Protection、Provenance/SBOM Audit の5項目を追加。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request adds comprehensive security and compliance checks to the repo-maintenance command documentation, including GitHub Actions security hardening, push protection verification, dependency review validation, deployment environment protection checks, and provenance/SBOM audit capabilities with remediation guidance. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項(重大度順)
総評
|
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項(重大度順)
判定: patch is incorrect
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c81adc806d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| echo "⏭️ GitHub Environments 未使用" | ||
| else | ||
| # 各環境の保護ルールを確認 | ||
| gh api "repos/$REPO/environments" --jq '.environments[] | {name, protection_rules}' 2>/dev/null | while read -r env; do |
There was a problem hiding this comment.
Collect environment issues without a pipeline subshell
Because the environment loop is fed by a pipe, Bash executes the while body in a subshell, so ISSUES+=(...) updates are discarded when the loop exits. In repositories where production environments are misconfigured, this check will still finish with an empty ISSUES array and report no problems, so the new protection audit silently fails.
Useful? React with 👍 / 👎.
| echo "⏭️ GitHub Environments 未使用" | ||
| else | ||
| # 各環境の保護ルールを確認 | ||
| gh api "repos/$REPO/environments" --jq '.environments[] | {name, protection_rules}' 2>/dev/null | while read -r env; do |
There was a problem hiding this comment.
Keep branch policy field in environment inspection output
The --jq filter narrows each environment object to {name, protection_rules}, but later logic reads .deployment_branch_policy; since that field was dropped, it is always null and every production/prod environment is flagged as missing branch policy even when configured correctly. This creates systematic false positives in the new deployment-protection check.
Useful? React with 👍 / 👎.
PR レビュー: repo-maintenance にサプライチェーン保護・本番リリース統制チェックを追加サプライチェーン保護の観点で価値の高い追加です。全体的な方向性は良いですが、いくつかバグと不整合が見つかりました。 バグ3.21: サブシェル問題で ISSUES 配列への追加が反映されない パイプの右辺はサブシェルになるため、ループ内の ISSUES+= が外部スコープに伝播しません。 修正案: パイプをプロセス置換に変更する 5.3: RELEASES が空の場合の算術比較エラー API 失敗時に RELEASES が空文字となり算術比較エラーになります。修正案: RELEASESが未設定の場合に0をデフォルト値とする 不整合3.20 の YAML テンプレートがタグ参照(SHA 未固定) 2.9 で SHA ピン留めを推奨しているのに、提示するテンプレート自体がタグ参照になっています。テンプレートを SHA 固定にするか、npx pin-github-action での後処理を明記すべきです。 改善提案2.9: pull_request_target の誤検知リスク 「ワークフローファイル内に pull_request_target: と secrets. が両方存在すれば警告」という粒度です。同ファイルの無関係な job に secrets が使われていても警告が出ます。精度向上か誤検知前提の注記追加を検討してください。 2.9: github/ org の除外根拠を補足 github/codeql-action は GitHub 管理ですが github/ org にはサードパーティも存在します。現在の除外パターンの根拠をコメントで補足すると保守しやすくなります。 3.21: multiline JSON のパース --jq は複数オブジェクトをストリーム出力するため、ネストした JSON が正しくパースできません。jq -c で compact 出力を確保してください。 良い点
3.21 のサブシェルバグ と 5.3 の空文字チェック漏れ は実行時に期待通り動作しない問題です。3.20 のテンプレートが自己矛盾(SHA 未固定)になっている点も次の機会に修正することを推奨します。 🤖 Generated with Claude Code |
|
🎉 This PR is included in version 1.97.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
追加チェック項目
Environment カテゴリ
GITHUB_TOKENのpermissions明示、許可 actions 制限、pull_request_targetの安全性チェックSetup カテゴリ
actions/dependency-review-actionの CI 組み込み確認・テンプレート生成Discovery カテゴリ
Test plan
/repo-maintenance --mode check-onlyで新チェック項目が正常に表示される/repo-maintenance --mode fullで各チェックが正常に実行・修正提案される🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Documentation