Skip to content

ci: upload only fixable scan findings - #202

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.yaml, the weekly scan in scan.yaml); 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.yaml) sets it, so each run has a trivy-report-release-image artifact.
  • The action is identical to the FOCA copy (ci: upload only fixable scan findings foca#439); its header no longer names repository-specific workflow files and says that the FOCA, cloud-registry and proTES copies must stay identical.
  • Docs: "Verifying images and charts" (docs/operations.md) and the image scan section of docs/development.md describe what code scanning shows and where the full report is. Comments in checks.yaml and scan.yaml 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. After the merge, the push to dev (category image) and a manual run of the weekly scan (category release-image, default branch dev) should close them; I will check with the code scanning API.

Verification

  • pre-commit run --files <changed files>: all hooks passed (check-yaml, actionlint, semgrep, gitleaks, ...).
  • mkdocs build --strict: passed.
  • diff of .github/actions/scan-image/action.yml with the FOCA branch: identical.
  • FOCA's CI with the same action (foca#439, merged): scans passed; open Trivy alerts on the PR ref 14, against 178 on dev.
  • CI: all checks passed (run 39969132823).

Declined review findings

  • Sourcery on foca#439 (medium, same action): 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 #201

🤖 Generated with Claude Code

Summary by Sourcery

Upload only actionable Trivy findings to code scanning while preserving complete scan reports as optional workflow artifacts.

New Features:

  • Add optional full Trivy report artifacts, including unfixed findings, to weekly image scans.

Bug Fixes:

  • Limit code scanning uploads to findings with available fixes while preserving failures for fixable critical and high findings.

CI:

  • Configure weekly scans to publish full JSON and table reports as workflow artifacts.

Documentation:

  • Document the distinction between actionable code scanning alerts and complete workflow reports.

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. The action is identical to the FOCA copy again
(repository-neutral header) and the docs describe the change.

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 the shared image-scan action so SARIF uploads contain only fixable findings, while scan failure behavior remains focused on fixable critical and high findings. It adds an opt-in full JSON/table report artifact, enabled for weekly scans, and updates workflow comments and operational/development documentation to explain the two reporting paths.

Flow diagram for fixable findings and full scan reports

flowchart TD
    A[Trivy scans image] --> B{report enabled?}
    A --> C[Fixable findings]
    C --> D[Upload SARIF to code scanning]
    C --> E[Fail on fixable critical and high findings]
    B -->|true| F[Full findings including unfixed]
    F --> G[Write trivy-report.json]
    F --> H[Write trivy-report.txt]
    G --> I[Upload trivy-report-category artifact]
    H --> I
    B -->|false| J[No full report artifact]
Loading

File-Level Changes

Change Details Files
Restrict code-scanning uploads to actionable findings while preserving unchanged failure behavior for fixable critical and high findings.
  • Enable Trivy's unfixed-finding filter for SARIF generation.
  • Keep accepted findings excluded and retain existing scan failure criteria.
  • Update action and workflow comments to describe the new alert scope.
.github/actions/scan-image/action.yml
.github/workflows/checks.yaml
.github/workflows/scan.yaml
Add an optional complete Trivy report delivered as workflow artifacts.
  • Introduce the opt-in report input, disabled by default.
  • Run additional JSON and table scans without the unfixed filter.
  • Upload both report files under a category-specific artifact name.
  • Enable reporting for the weekly release-image scan.
.github/actions/scan-image/action.yml
.github/workflows/scan.yaml
Document the distinction between actionable code-scanning alerts and complete scan reports.
  • Explain that unfixed findings appear in code scanning after a fix is released.
  • Document the weekly full-report artifact location and file formats.
  • Clarify that accepted findings are omitted from all results.
docs/development.md
docs/operations.md

Assessment against linked issues

Issue Objective Addressed Explanation
#201 Upload only fixable findings to code scanning in PR, dev, release, and weekly scans, and verify that subsequent scans close existing alerts for unfixed findings. ❌ The shared action filters uploaded SARIF with ignore-unfixed: true, and the PR describes how scans should close alerts that are no longer present. However, the PR explicitly leaves the release scan unchanged because it does not upload to code scanning, so the requested release-scan behavior is not implemented. The planned check that existing alerts close is also still pending.
#201 Provide a weekly full report that includes unfixed findings as a workflow artifact, without uploading that report to code scanning, and document where maintainers can find it and what code scanning shows. ✅
#201 Apply the same action change to every repository that uses the shared action and keep the copies identical. ❌ The PR states that the action matches the FOCA copy, but the provided diff does not show the corresponding change in the proTES repository. The issue requires the change in all repositories using the action.

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 (a5cfba7) to head (58d5f76).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #202   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         1136      1136           
=========================================
  Hits          1136      1136           

☔ 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.

@uniqueg
uniqueg marked this pull request as ready for review October 23, 2026 14:34

@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 reviewed your changes and they look great!

Sourcery assessment

Approved.


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

@uniqueg
uniqueg merged commit 8ce016b into dev Oct 23, 2026
19 checks passed
@uniqueg
uniqueg deleted the ci/fixable-scan-findings branch October 23, 2026 14:38
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.

ci: upload only fixable scan findings

1 participant