ci: attach provenance and SBOM attestations to the published images - #8398
ci: attach provenance and SBOM attestations to the published images#8398kobihikri wants to merge 1 commit into
Conversation
|
Correction — I got a fact wrong in this PR, and I would rather flag it myself than let it sit. I wrote that the pushed manifest "carries no provenance or SBOM attestation". That is half wrong, and the wrong half matters. Provenance is already there. For public repositories, The SBOM is genuinely new. That part stands — the same page says "SBOM attestations aren't automatically added to the image", and I also wrote in the caveats that So the honest description of this PR is: it adds an SBOM attestation, and pins the provenance mode explicitly instead of relying on the default. Both are still defensible — an explicit line means the behaviour will not change quietly if the default ever does — but it is a smaller change than my description implied, and you should judge it on that basis rather than on what I originally wrote. Happy to retitle and rewrite the description accordingly, or to close this if the SBOM alone is not worth the diff to you. Either is fine — just say which and I will act on it. Apologies for the inaccuracy. It was caught by a maintainer reviewing the same change on another project, and they were right to. |
| context: . | ||
| platforms: linux/amd64 | ||
| push: true | ||
| provenance: mode=max |
There was a problem hiding this comment.
These two ttl.sh steps push throwaway 7-day images only so Trivy can scan them, nobody consumes them as artifacts. Better to drop provenance/SBOM here and keep it on the real publish targets.
| file: Dockerfile.next | ||
| platforms: linux/amd64 | ||
| push: true | ||
| provenance: mode=max |
There was a problem hiding this comment.
Same here, this is the ttl.sh scan-only push. No consumer for these attestations.
Hi, and thanks for Gogs.
.github/workflows/docker.ymlpublishes the images to three registries — Docker Hub,ghcr.ioandregistry.digitalocean.com— across five build steps, but none of the pushed manifests carry a provenance or SBOM attestation. Someone pullinggogs/gogs:latestcan see it exists; they cannot check that it was built by this workflow from this repository.Gogs is self-hosted and the image is normally what people deploy directly, so the image is the artifact — there is no intermediate package manager doing any vouching along the way.
Worth saying up front that the security posture here is already better than most: every one of these steps is followed by a Trivy scan with
exit-code: '1', so a vulnerable image genuinely fails the build rather than just printing a warning. This PR is the complementary half — Trivy answers "is there anything known-bad inside", provenance answers "did this come from where it claims".The change is two lines on each of the five
push: truesteps:I used BuildKit's own attestation support rather than a separate signing step, deliberately: each of your steps pushes one build to three registries at once, and BuildKit attaches the attestation to the image manifest, so all three get it with no extra plumbing and no second credential. It also means no permissions change —
contents: readstays exactly as it is and nothing needsid-token.Consumers can then check any tag with:
Two caveats I would rather state than leave you to find:
mode=maxrecords the full build including build arguments. That is usually what you want for a public image; if any build arg has ever been sensitive,provenance: truegives a smaller record.No SLSA level claimed — the attestation is what BuildKit produces, and characterising the whole build is your call.
Disclosure: I used AI assistance to help spot this and prepare the change, and I read the workflow and all five push targets myself.