ci: fix trivy scan alerts not resolving by setting SARIF category per image - #223
Merged
Merged
Conversation
All 32 matrix jobs uploaded trivy SARIF results with no category, so they shared a single code-scanning analysis. The last job to finish became the 'current' analysis, causing alerts from the other images to be resolved and reopened on every run - nothing ever stayed fixed. Give each matrix combination (PHP version + variant) its own category so alerts resolve automatically once the vulnerability is gone from the published image.
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.
Problem
The security workflow runs trivy scans across a matrix of 4 PHP versions x 8 image variants (32 jobs), and every job uploaded its SARIF with no
categoryset. GitHub groups code-scanning analyses by(tool, category, ref), so all 32 uploads shared one analysis — the last job to finish became the "current" one. On every nightly run, alerts from all other images got resolved and then reopened, producing constant churn and alerts that never stayed fixed (1,296 stale open alerts accumulated).Fix
Set a unique
categoryper matrix combination (php-version-variant) in theupload-sarifstep, so each image has its own analysis and its alerts auto-resolve once the vulnerability is actually gone from the published image.Note
The existing open alerts were created under the old empty category and are orphaned — they have been bulk-closed manually. Alerts for CVEs still present in the current images will be re-reported by the next scan, this time under the correct category.