DAT-21268: Persist vulnerability scan results to scan-results branch#514
DAT-21268: Persist vulnerability scan results to scan-results branch#514
Conversation
After vulnerability scans complete, a new persist-results job downloads all scan artifacts and commits them to a scan-results branch. This gives the Liquibase Security dashboard persistent access to historical scan data via GitHub Contents API, replacing the 7-day artifact retention. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
|
Claude finished @jandroav's task in 1m 57s —— View job Code Review: DAT-21268 - Persist vulnerability scan results
Overall the implementation is clean and well-structured. Two issues worth addressing:
|
| echo "Warning: unknown image prefix: $IMAGE, skipping" >&2 | ||
| continue | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
The image prefix mapping is hardcoded to only two images. If new images are added to the scanning matrix, they'll be silently skipped (only a warning is printed). Consider making this data-driven or failing loudly on unknown prefixes instead of continue.
| .images |= with_entries( | ||
| .value |= sort_by(split(".") | map(tonumber? // 0)) | reverse | ||
| ) | ||
| ') |
There was a problem hiding this comment.
The version sort uses tonumber? // 0 to handle non-numeric semver parts. Tags like latest, 6.0, or pre-release identifiers (e.g., 5.0.1-beta) will have their non-numeric segments mapped to 0, potentially causing incorrect sort ordering. Consider filtering to pure semver tags before sorting, or using string-based sort as a fallback.
There was a problem hiding this comment.
Pull request overview
Adds automation to persist published-image vulnerability scan artifacts into a long-lived scan-results branch (for consumption via GitHub Contents API), extending access beyond the default artifact retention period.
Changes:
- Introduces
scripts/persist-scan-results.shto collect scan artifacts, update amanifest.json, and push results toscan-results. - Updates the published-images scanning workflow to add a
persist-resultsjob that runs after scans and pushes results to the branch. - Adjusts GitHub Actions
contentspermissions to enable branch pushes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/persist-scan-results.sh | New script to assemble artifact outputs, write per-tag metadata, maintain a manifest, and commit/push to scan-results. |
| .github/workflows/trivy-scan-published-images.yml | Adds the persistence job and elevates contents permission to support pushing scan results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| permissions: | ||
| contents: read | ||
| contents: write | ||
| actions: read |
There was a problem hiding this comment.
Workflow-level contents: write broadens token permissions for all jobs, but only persist-results needs push access. Consider keeping workflow permissions at contents: read and setting job-level permissions (persist-results: permissions: contents: write) to follow least-privilege.
The artifacts directory was passed as a relative path but the script cd's into a temporary git worktree, breaking the glob. Convert to absolute path at the start. Also fix grep -c exit code handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @jandroav's task in 2m 9s —— View job Code Review: DAT-21268 - Persist vulnerability scan results
What's fixed in the latest commit (
|
Add parentheses around `sort_by(...) | reverse` so that `reverse` applies to the sorted array inside each image entry, not to the outer `with_entries` object — which caused "Cannot index object with number" at runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @jandroav's task in 1m 7s —— View job Code Review: DAT-21268 - Persist vulnerability scan results
What's fixed in the latest commit (
|
Summary
scripts/persist-scan-results.shto download scan artifacts and commit them to a persistentscan-resultsbranchpersist-resultsjob to the published images scanning workflow that runs after all scans completecontentspermission fromreadtowriteto allow pushing to thescan-resultsbranchThis enables the Liquibase Security dashboard to read historical scan data via GitHub Contents API, replacing the 7-day artifact retention window.
Branch structure
Test plan
gh workflow run "Published Images Vulnerability Scanning"scan-resultsbranch is created withmanifest.jsonand versioned scan datamanifest.jsonlists all scanned images and tagstrivy-surface.json,trivy-deep.json,grype-results.json,metadata.json🤖 Generated with Claude Code