Skip to content

ci: add reusable Trivy image scan - #6

Merged
vkartk merged 1 commit into
mainfrom
feat/image-scan
Oct 28, 2026
Merged

vkartk merged 1 commit into
mainfrom
feat/image-scan

Conversation

@vkartk

@vkartk vkartk commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Adds scan-image.yml, a reusable workflow that scans an image repo's published images with Trivy. Prompted by CaddyBuilds/caddy-cloudflare#43, where a user has been running these scans by hand.

  • Scans latest, plus slim when caddy-image.json enables it, on linux/amd64.
  • Uploads SARIF to code scanning with one category per tag, so each alert closes once a rebuild no longer contains the finding.
  • Writes the same results as a table to the run summary. Code scanning alerts need write access to view, and run summaries are public on a public repo.
  • Report only: findings never fail the run, because fixes arrive through rebuilds, not pins.
  • trivy-action (v0.36.0) and upload-sarif (v4.39.1) are pinned by commit, since trivy-action's release tags were hijacked in March 2026. Trivy itself is pinned to v0.76.1.
  • Fork-friendly: the image name comes from GITHUB_REPOSITORY, and GHCR credentials from GITHUB_TOKEN cover private packages.

Also adds examples/.github/workflows/scan-images.yml (daily at 06:00 UTC, after each successful build, and manual) and documents both in the README.

Tested locally with Trivy 0.76.1 against ghcr.io/caddybuilds/caddy-cloudflare:slim. The JSON → SARIF → table conversions work, and they report the same 11 findings as #43. actionlint passes; its only warnings are the job.workflow_sha ones the existing workflows also get.

Scans the caller's published latest and slim images with Trivy, uploads SARIF to code scanning and writes the same results as a table to the run summary, since code scanning alerts need write access to view. Report only; never fails the run. trivy-action and upload-sarif are pinned by commit.
@vkartk
vkartk merged commit 56d9951 into main Oct 28, 2026
1 check passed
@vkartk
vkartk deleted the feat/image-scan branch October 28, 2026 18:42
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