fix(reusable-trivy): authenticate to GHCR before scanning image-ref - #33
Merged
Conversation
The `image` job scans `image-ref` by digest directly from the
registry, but never logs in first. Trivy's image-source resolution
tries docker/containerd/podman/remote in order; all four fail on a
runner with no local copy of the image, including the remote pull
("UNAUTHORIZED: authentication required") since it has no
credentials. Add the same docker/login-action step
sign-and-attest.yml already uses for the identical registry.
Confirmed on go-htmx's v0.1.1 release run: gate-image/image failed
with exactly this error immediately after docker-sign/docker-verify
both succeeded against the same image digest.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes reusable-trivy.yml’s image job failing to scan digest-based image-ref values from GHCR by authenticating to GHCR before running Trivy, enabling Trivy’s remote registry backend to fetch the image.
Changes:
- Add a pinned
docker/login-actionstep to log in toghcr.iousingGITHUB_TOKENbefore the Trivy image scan. - Document why authentication is required for digest-based remote scans (and align with
sign-and-attest.ymlbehavior).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 13, 2026
Closed
zircote
added a commit
to attested-delivery/go-htmx
that referenced
this pull request
Jul 13, 2026
* changelog: add v0.1.2 — complete container attestation set v0.1.1's container image is signed with SLSA provenance and an SBOM attestation but is missing the vulnerability-scan attestation (the reusable-trivy.yml GHCR-auth bug fixed at attested-delivery/.github#33 and picked up in this repo's pin bump). v0.1.2 ships the same code with the pipeline fix, completing the attestation set. * changelog: fix wording — gate-image is a job, not a step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reusable-trivy.yml'simagejob failed on go-htmx'sv0.1.1release run (job 86817144520), right afterdocker-sign/docker-verifyboth succeeded against the same image digest:Root cause
image-refis scanned by digest straight from the registry (there's no local docker/containerd/podman image on the runner), so Trivy falls through to the remote pull path — which needs credentials it never got. The job grantspackages: readbut never actually logs in to GHCR.Fix
Add the identical
docker/login-actionstepsign-and-attest.ymlalready uses for the same registry, before the scan step.Verification
actionlint .github/workflows/reusable-trivy.ymlpasses clean.