Repository navigation
ci: upload only fixable scan findings - #439
Conversation
Upload only findings that have a fix (ignore-unfixed) to code scanning from the shared scan-image action, so that the alerts show what can be acted on. A new report input uploads a full report, findings without a fix included, as a workflow artifact (JSON and table); the weekly scan sets it. Align the action with the cloud-registry copy (same codeql-action pin, repository-neutral header) and update the docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR changes image scanning so SARIF uploads contain only fixable Trivy findings, while retaining unchanged failure behavior and providing optional complete JSON/table reports as workflow artifacts; the weekly scan enables those reports, with workflows and documentation updated accordingly. Sequence diagram for fixable image scan and optional full reportsequenceDiagram
participant Workflow
participant ScanImage
participant Trivy
participant CodeScanning
participant Artifact
Workflow->>ScanImage: Scan image
ScanImage->>Trivy: Run scan with ignore-unfixed: true
Trivy-->>ScanImage: trivy-results.sarif
opt upload == true
ScanImage->>CodeScanning: upload-sarif(trivy-results.sarif, category)
end
opt report == true
ScanImage->>Trivy: Run full scan as JSON
Trivy-->>ScanImage: trivy-report.json
ScanImage->>Trivy: Run full scan as table
Trivy-->>ScanImage: trivy-report.txt
ScanImage->>Artifact: Upload trivy-report-<category>
end
ScanImage->>Trivy: Fail on fixable critical and high findings
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #439 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 2869 2869
=========================================
Hits 2869 2869
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/actions/scan-image/action.yml" line_range="44" />
<code_context>
with:
image-ref: ${{ inputs.image }}
trivyignores: .trivyignore.yaml
+ ignore-unfixed: true
format: sarif
output: trivy-results.sarif
</code_context>
<issue_to_address>
**Secrets bypass fixable-only filtering**
When the image contains a secret detected by Trivy, `ignore-unfixed` filters vulnerability results, not secret findings, so detected secrets remain in `trivy-results.sarif` and are uploaded to code scanning without a fix.
Filter secret findings out of the SARIF uploaded to code scanning so the fixable-only policy is enforced.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: .github/actions/scan-image/action.yml:44
Summary
.github/actions/scan-image: the SARIF upload to code scanning contains only findings that have a fix (ignore-unfixed: true). This applies to every scan that uploads (pull requests and pushes todevinchecks.yml, the weekly scan inscan.yml); the release scan does not upload and is unchanged. Findings without a fix show up as alerts once a distribution ships a fix. Failing on fixable critical and high findings is unchanged.report(default"false"): uploads a full report, findings without a fix included, as the workflow artifacttrivy-report-<category>(trivy-report.jsonandtrivy-report.txt, a table). It is not uploaded to code scanning. The weekly scan (scan.yml) sets it, so each run hastrivy-report-release-image-pyVartifacts.codeql-action/upload-sarifpin (v4.39.0; FOCA had v4.38.3) and a repository-neutral header that says the FOCA, cloud-registry and proTES copies must stay identical.docs/deployment.md) and "Image scan" (docs/contributing.md) describe what code scanning shows and where the full report is. Comments inchecks.ymlandscan.ymlupdated.Light lane: CI-only change without secrets or permission changes (the artifact upload needs no extra permission); the release workflow is not touched. I reviewed the diff myself.
Existing alerts for unfixed findings: code scanning closes alerts that are missing from the next analysis of the same category on the same ref. On
dev, the first push after this merge (categoriesimage-pyV) should close them; I will check with the code scanning API after thedevrun. The weekly scan runs on the default branch (main), so its categories (release-image-pyV) switch to fixable-only, and get the full report artifact, once 0.17.0 is released tomain.Verification
pre-commit run --files <changed files>: all hooks passed (check-yaml, semgrep, ...).mkdocs build --strict: passed.zizmor --offlineon the action andscan.yml: no new findings (one existing low finding about./self-references, as before).diffof.github/actions/scan-image/action.ymlwith the cloud-registry branch: identical.refs/pull/439/merge): 14, against 178 ondev, so the upload now has only fixable findings.Declined review findings
ignore-unfixedand are uploaded. Intended: a secret in an image can always be acted on (remove and rotate it), and critical and high secrets already fail the scan; accepted secrets stay out via.trivyignore.yaml.Open questions
None.
Closes #438
🤖 Generated with Claude Code