Sign released Docker images with cosign - #1481
Open
simonharrer wants to merge 1 commit into
Open
Conversation
Keyless signing via the release workflow's GitHub OIDC identity, so no key material has to be managed. The image digest is signed rather than the tags, which are mutable. The ECR mirror now uses `cosign copy` instead of `docker buildx imagetools create`, because imagetools copies the manifest only and would leave the signature and the SBOM/provenance attestations behind on Docker Hub.
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.
Adds cosign keyless signing to the released Docker images, on both Docker Hub and the Amazon ECR Public mirror.
The PyPI artifacts are already signed with Sigstore, and the images already carry an SBOM and SLSA provenance (
sbom: true,provenance: mode=max). Signatures were the missing piece: nothing tied the published image to this release workflow in a way a consumer could verify. This also unblocks users running admission policies (Kyverno, Gatekeeper) that require a verifiable signature.Changes
.github/workflows/release.yamldockerjob getsid-token: writeand signs the image withcosign signafter the push. Keyless — the signing identity is the workflow's GitHub OIDC token, so there is no key material to manage or rotate.datacontract/cli@sha256:…) rather than a tag. Tags are mutable, and the digest covers the whole multi-arch index.push-to-ecrjob switches fromdocker buildx imagetools createtocosign copy.imagetools createcopies the manifest only and would leave the signature (a separatesha256-<digest>.sigtag) and the attestations behind on Docker Hub;cosign copycarries all three across.Docs — a "Verifying the image" section in
docs/docs/installation.md, a pointer to it from the README, and a CHANGELOG entry. The section also documents the ECR Public mirror, which was previously published but undocumented.Verification
cosign verify datacontract/cli:latest \ --certificate-identity-regexp '^https://github\.com/datacontract/datacontract-cli/\.github/workflows/release\.yaml@refs/tags/v' \ --certificate-oidc-issuer https://token.actions.githubusercontent.comBoth flags are required and documented as such — without pinning the identity and issuer,
cosign verifyaccepts any valid Sigstore signature, including one produced by someone else.Notes
github.event_name != 'pull_request', matching the existingpush:condition on the build step.Unreleasedtarget in the CHANGELOG. Worth a second look if that target moves.