Skip to content

Sign published container images - #227

Open
andrew wants to merge 2 commits into
mainfrom
issue-225-sign-container-image
Open

Sign published container images#227
andrew wants to merge 2 commits into
mainfrom
issue-225-sign-container-image

Conversation

@andrew

@andrew andrew commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Adds keyless Cosign signing for published container images. Enables full provenance and SBOM attestations in Buildx, then verifies both are present in GHCR.

Closes #225

@acidghost acidghost 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.

LGTM!

You could also sign the SBOM as attestations: extract the SBOM and issue cosign attest over the file. I ended up updating my repo after opening the issue here 😅 (ref1, ref2). Downstream consumers might require the signature on the attestations before trusting the predicate (eg extractPayload from Kyverno).

@andrew

andrew commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (picks up #230 multi-arch and #232 login-action bump; dropped the now-duplicate setup-buildx-action step). cosign sign now signs the manifest-list digest, and the attestation checks hold since .Provenance/.SBOM become per-platform-keyed objects.

Opened #236 to track cosign attest over the SBOM per @acidghost's suggestion — keeping this PR to image signing so it lands for v0.7.0.

Extract each platform's SPDX document from the BuildKit SBOM attestation
and sign it as a cosign spdxjson attestation against the manifest-list
digest, so downstream consumers (e.g. Kyverno image-verification policies)
can verify the predicate signature rather than relying on the unsigned
BuildKit attachment.

Copilot AI 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.

Pull request overview

Adds Sigstore Cosign-based keyless signing and BuildKit-generated provenance/SBOM attestations to the container publish workflow, aligning the repo’s GHCR publishing with supply-chain metadata expectations from #225.

Changes:

  • Grants the workflow OIDC permissions and installs Cosign for keyless signing.
  • Enables Buildx provenance (mode=max) and SBOM generation during image build/push.
  • Verifies BuildKit attestations are present in GHCR and publishes SPDX SBOM predicates as Cosign attestations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +77 to +80
set -euo pipefail
reference="${IMAGE}@${DIGEST}"
docker buildx imagetools inspect "$reference" --format '{{ json .Provenance }}' > provenance.json
docker buildx imagetools inspect "$reference" --format '{{ json .SBOM }}' > sbom.json
@andrew
andrew requested a review from acidghost August 10, 2026 10:45
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.

Sign container image and attach provenance and SBOM attestations

3 participants