fix(ci): reduce Trivy scan noise#144
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConfigures Trivy scanning in CI and release workflows to only report fixable library vulnerabilities and uploads them to distinct SARIF categories to reduce duplicated and non-actionable alerts. Sequence diagram for updated Trivy scan and SARIF upload in CI workflowsequenceDiagram
actor Developer
participant GitHubActions_ci_publish as GitHubActions_ci_publish_workflow
participant TrivyScanner as Trivy_scanner
participant SARIFUploader_ci as SARIF_uploader_ci
participant GitHubSecurity as GitHub_Code_Scanning
Developer->>GitHubActions_ci_publish: Push commit or open PR
GitHubActions_ci_publish->>TrivyScanner: Run scan with ignore_unfixed true
TrivyScanner-->>GitHubActions_ci_publish: trivy-results.sarif (library_only)
GitHubActions_ci_publish->>SARIFUploader_ci: Upload SARIF with category trivy_ci_scan
SARIFUploader_ci->>GitHubSecurity: Store alerts under category trivy_ci_scan
GitHubSecurity-->>Developer: Show actionable library alerts from CI scan
Sequence diagram for updated Trivy scan and SARIF upload in release workflowsequenceDiagram
actor ReleaseEngineer
participant GitHubActions_build_push as GitHubActions_build_and_push_workflow
participant TrivyScanner as Trivy_scanner
participant SARIFUploader_release as SARIF_uploader_release
participant GitHubSecurity as GitHub_Code_Scanning
ReleaseEngineer->>GitHubActions_build_push: Trigger release build and push
GitHubActions_build_push->>TrivyScanner: Run scan with ignore_unfixed true
TrivyScanner-->>GitHubActions_build_push: trivy-results.sarif (library_only)
GitHubActions_build_push->>SARIFUploader_release: Upload SARIF with category trivy_release_scan
SARIFUploader_release->>GitHubSecurity: Store alerts under category trivy_release_scan
GitHubSecurity-->>ReleaseEngineer: Show actionable library alerts from release scan only
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider adding brief inline comments in the workflow YAML explaining why
vuln-type: 'library'andignore-unfixed: trueare intentional, so future maintainers don’t revert them thinking they’re loosening security by mistake. - If you expect to reuse these Trivy settings elsewhere, you might want to extract the common configuration (severity, exit-code, ignore-unfixed, vuln-type) into a shared reusable workflow or composite action to keep behavior consistent across pipelines.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding brief inline comments in the workflow YAML explaining why `vuln-type: 'library'` and `ignore-unfixed: true` are intentional, so future maintainers don’t revert them thinking they’re loosening security by mistake.
- If you expect to reuse these Trivy settings elsewhere, you might want to extract the common configuration (severity, exit-code, ignore-unfixed, vuln-type) into a shared reusable workflow or composite action to keep behavior consistent across pipelines.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
PR image build and manifest generation completed successfully! 📦 PR image: 🗂️ CI manifests |
Trivy was scanning OS packages and reporting unfixed CVEs, flooding the GitHub Security tab with 11k+ unactionable alerts. Scope scans to library dependencies only and skip CVEs with no available fix. Add SARIF upload categories to prevent duplicate alert entries across runs. Tested locally: 3,042 → 7 findings on the release image. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Rust crate CVEs inside the uv and uvx binaries are Astral's supply chain responsibility, tracked via Dependabot version bumps rather than container image scanning. Skip these files to eliminate 6 duplicate alerts per scan. Tested locally: 7 → 1 remaining finding (pip version, fixable by us). Co-Authored-By: Claude Opus 4.6 <[email protected]>
3da0c46 to
1a59aa8
Compare
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
Tune Trivy CI scan configuration to reduce noise from OS-level and unfixable CVEs. Builds on top of PR #146 (UBI9 minimal multi-stage image).
vuln-type: 'library'): OS-level CVEs (glibc, openssl, etc.) are Red Hat's responsibility via UBI9 base image updatesignore-unfixed: true): hides CVEs with no available patch to reduce noiseskip-files): Rust crate CVEs inside uv are Astral's supply chain responsibility, tracked via Dependabotcategory: 'trivy-ci-scan'/'trivy-release-scan'): prevents duplicate alert entries across scan runsWorkflows modified
build-and-push.yamlci-publish.yamlTest plan
🤖 Generated with Claude Code