Skip to content

ci: upload only fixable scan findings - #439

Merged
uniqueg merged 1 commit into
devfrom
ci/fixable-scan-findings
Oct 23, 2026
Merged

uniqueg merged 1 commit into
devfrom
ci/fixable-scan-findings

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

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 to dev in checks.yml, the weekly scan in scan.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.
  • New input report (default "false"): uploads a full report, findings without a fix included, as the workflow artifact trivy-report-<category> (trivy-report.json and trivy-report.txt, a table). It is not uploaded to code scanning. The weekly scan (scan.yml) sets it, so each run has trivy-report-release-image-pyV artifacts.
  • The action is now identical to the cloud-registry copy (ci: upload only fixable scan findings cloud-registry#201): same codeql-action/upload-sarif pin (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: "Verifying images and charts" (docs/deployment.md) and "Image scan" (docs/contributing.md) describe what code scanning shows and where the full report is. Comments in checks.yml and scan.yml updated.

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 (categories image-pyV) should close them; I will check with the code scanning API after the dev run. 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 to main.

Verification

  • pre-commit run --files <changed files>: all hooks passed (check-yaml, semgrep, ...).
  • mkdocs build --strict: passed.
  • zizmor --offline on the action and scan.yml: no new findings (one existing low finding about ./ self-references, as before).
  • diff of .github/actions/scan-image/action.yml with the cloud-registry branch: identical.
  • CI: all checks passed (run 39967609590). Open Trivy alerts on the PR ref (refs/pull/439/merge): 14, against 178 on dev, so the upload now has only fixable findings.

Declined review findings

  • Sourcery (medium): secret findings bypass ignore-unfixed and 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

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]>
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The 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 report

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Limit code-scanning uploads to actionable Trivy findings while preserving failure behavior for fixable high and critical vulnerabilities.
  • Enable ignore-unfixed for the SARIF scan.
  • Retain the existing Trivy ignore file and fixable severity failure logic.
  • Update the pinned CodeQL upload action and document synchronization with related repositories.
.github/actions/scan-image/action.yml
Add optional full scan reports as workflow artifacts and enable them for weekly release-image scans.
  • Add the report input, disabled by default.
  • Run JSON and table-format full scans without ignore-unfixed.
  • Upload both report files under a category-specific artifact name.
  • Enable reporting for each weekly release-image matrix entry.
.github/actions/scan-image/action.yml
.github/workflows/scan.yml
Align workflow and user documentation with fixable-only code scanning and artifact-based full reports.
  • Clarify that unfixed findings are excluded from code scanning until a fix is available.
  • Document weekly full-report artifact names, formats, and location.
  • Update workflow comments to describe the revised scan outputs.
.github/workflows/checks.yml
.github/workflows/scan.yml
docs/contributing.md
docs/deployment.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6d2989c) to head (85a2d9a).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #439   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2869      2869           
=========================================
  Hits          2869      2869           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/actions/scan-image/action.yml Resolved
@uniqueg
uniqueg merged commit 12e863c into dev Oct 23, 2026
23 checks passed
@uniqueg
uniqueg deleted the ci/fixable-scan-findings branch October 23, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant