ci: add OSV-Scanner Full Scan reusable workflow - #82
Draft
oqrusk wants to merge 4 commits into
Draft
Conversation
各リポジトリの daily フルスキャンを集約するための reusable workflow を追加する。 caller 側に schedule trigger を持つ薄いラッパーを置く運用にすることで、scanner action のバージョンや wiring を中央で一元管理できる。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GHAS なし運用前提で以下を追加: - upload-sarif: false(private リポジトリで Code Scanning upload が失敗するため) - fail-on-vuln: true(明示) - 脆弱性検出時に Slack へ通知する notify-slack ジョブを追加 caller 側は SLACK_WEBHOOK_URL を secrets: inherit で渡す前提。Org 共通の Slack webhook を Org Secret として登録しておけば全リポジトリで動作する。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
汎用名 SLACK_WEBHOOK_URL は他用途と衝突するため、OSV-Scanner 専用名にリネーム。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Slack 通知に加えて、検出時に該当リポジトリへ Issue を自動作成する。 既存の OSV-Scanner Issue がオープン中なら新規作成せずコメント追記し、 クローズ後の再検出時に新しい Issue が作られる運用とする。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
概要
各リポジトリで daily の OSV フルスキャンを行うための reusable workflow を追加する。脆弱性検出時に Slack 通知と GitHub Issue 作成の両方を行う。
背景
api-metric-service #107 で daily フルスキャンが導入されたが、現状は各リポジトリが直接
google/osv-scanner-actionを参照している。横展開を考えると本リポジトリに集約して reusable workflow として提供し、各リポジトリは薄いラッパーから呼び出す形にしたい。@v2.3.8) を中央で一元管理できる.github/workflowsをカバーしているので追加設定不要通知設計
buffett-code-dev は GitHub Team プランで GitHub Code Security (GHAS) を契約しておらず、Code Scanning(Security タブ)が private リポジトリで使えない。そのまま
upload-sarif: trueで動かすと private リポでは失敗する。また cron 失敗メールは「ワークフローファイルを最後にコミットした人」にしか届かないため、チームに気付ける形にする必要がある。採用した通知経路:
ジョブ構成:
scan-full: 既存のgoogle/osv-scanner-actionreusable をupload-sarif: false,fail-on-vuln: trueで呼ぶnotify-slack: 失敗時に Slack incoming webhook へ通知(slackapi/slack-github-action@v3.0.3)create-issue: 失敗時に GitHub Issue を作成 or コメント追記(actions/github-script@v9.0.0)Issue は タイトル prefix
[OSV-Scanner]で deduplication:各リポジトリでの呼び出し例
@main参照で中央更新を即時に全リポジトリへ反映secrets: inheritで Org Secret のOSV_SCANNER_SLACK_WEBHOOK_URLを引き渡すissues: write権限が必要事前準備(マージ前)
OSV_SCANNER_SLACK_WEBHOOK_URLとして登録動作確認方法
マージ後、テストリポジトリで上記ラッパーを workflow_dispatch から手動実行し以下を確認:
scan-full成功 →notify-slack/create-issueスキップscan-full失敗 → Slack 通知到着 + Issue 作成将来の発展
upload-sarif: trueに変更して Security タブ運用へ一斉移行可能。中央 reusable workflow を一箇所修正するだけで全リポジトリへ反映される。ref
osv-scanner.yml) はそのまま残す🤖 Generated with Claude Code