Skip to content

fix(golib-release): verify cosign signature against reusable workflow identity#165

Merged
CybotTM merged 1 commit into
mainfrom
fix/golib-cosign-verify-identity
Jun 2, 2026
Merged

fix(golib-release): verify cosign signature against reusable workflow identity#165
CybotTM merged 1 commit into
mainfrom
fix/golib-cosign-verify-identity

Conversation

@CybotTM

@CybotTM CybotTM commented Jun 2, 2026

Copy link
Copy Markdown
Member

Problem

The golib-create-release reusable 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's job_workflow_ref, not the caller. So verification fails:

failed to verify certificate identity: no matching CertificateIdentity found,
last error: expected SAN value to match regex "https://github.com/netresearch/go-cron/*",
got "https://github.com/netresearch/.github/.github/workflows/golib-create-release.yml@refs/heads/main"

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:

--certificate-identity-regexp "^https://github\.com/netresearch/\.github/\.github/workflows/golib-create-release\.yml@"

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.

… 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>
Copilot AI review requested due to automatic review settings June 2, 2026 15:48
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@CybotTM CybotTM merged commit a065ebc into main Jun 2, 2026
12 checks passed
@CybotTM CybotTM deleted the fix/golib-cosign-verify-identity branch June 2, 2026 15:50

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

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-blob to 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" \
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.

2 participants