fix(golib-release): verify cosign signature against reusable workflow identity#165
Merged
Merged
Conversation
… identity Keyless signing performed inside a reusable workflow produces a certificate whose SAN identity is the reusable workflow's job_workflow_ref (e.g. .../golib-create-release.yml@refs/heads/main), not the calling repository. The verify step matched https://github.com/<caller>/* and failed: failed to verify certificate identity: no matching CertificateIdentity found ... got "https://github.com/netresearch/.github/.github/workflows/ golib-create-release.yml@refs/heads/main" Match the reusable workflow's own identity instead. Observed on netresearch/go-cron v0.15.0 — the first release to actually run cosign signing (earlier the caller lacked id-token/attestations permissions). Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
There was a problem hiding this comment.
Pull request overview
This PR fixes cosign signature verification in the golib-create-release reusable workflow by validating against the reusable workflow’s own OIDC certificate identity (as produced by keyless signing inside a reusable workflow), instead of the calling repository identity.
Changes:
- Update
cosign verify-blobto use the reusable workflow identity pattern rather than${{ github.repository }}. - Add inline documentation explaining why the reusable workflow identity must be used for verification.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
198
to
201
| cosign verify-blob \ | ||
| --bundle checksums.txt.sigstore.json \ | ||
| --certificate-identity-regexp "https://github.com/${REPO}/*" \ | ||
| --certificate-identity-regexp "^https://github\.com/netresearch/\.github/\.github/workflows/golib-create-release\.yml@" \ | ||
| --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \ |
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.



Problem
The
golib-create-releasereusable workflow's Verify Cosign signature step uses--certificate-identity-regexp "https://github.com/${github.repository}/*"(the calling repo). But keyless signing performed inside a reusable workflow yields a certificate whose SAN identity is the reusable workflow'sjob_workflow_ref, not the caller. So verification fails:Observed on netresearch/go-cron v0.15.0 — the first release to actually run cosign signing (prior releases couldn't even start the workflow until the caller perms were fixed in #163).
Fix
Verify against this workflow's own identity:
Follow-up (not in this PR)
Downstream verification instructions in consuming repos' release notes should likewise reference the reusable-workflow identity rather than the per-repo identity.