Optimize Trivy scanning by reusing container scan state - #551
Merged
Merged
Conversation
- scan the release container archive once with Trivy - reuse the JSON scan result for SARIF and SPDX generation - preserve HIGH/CRITICAL fail-closed release gating - reuse Trivy cache while retaining normal database freshness checks - keep all security evidence tied to the exact published image archive Closes #533
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.
Summary
Optimizes the container release workflow so Trivy no longer performs three independent scans of the same saved container image archive.
The workflow now performs a single Trivy scan against
artifacts/container-image.tarand reuses that scan result to produce the existing security and release evidence.Changes
HIGH,CRITICALvulnerability release gate.Security behavior preserved
This change does not weaken the container release security controls.
The workflow continues to:
Benefit
Previously, the same image archive could trigger repeated Trivy setup, database access, package analysis, and vulnerability evaluation.
Reusing a single scan result reduces duplicate CPU and network work while ensuring SARIF, SBOM, and vulnerability-gate decisions are derived from the same scan state.
Validation
git apply --checkgit diff --checkRuntime and network improvement can be measured against the previous workflow during the next container release execution.
Closes #533