Repository navigation
gh attestation verify: match the OIDC subject (sub) claim #13928
Description
Problem
gh attestation verify can pin the source repo (--repo/--owner), the signer workflow (--cert-identity/--signer-workflow), and — since #9602 / #10308 — source ref/digest and signer digest. The one identity axis still not matchable is the OIDC subject (sub) claim, e.g.:
repo:my-org@<ORG_ID>/my-repo@<REPO_ID>:environment:release-stable
Two reasons this is worth a first-class matcher rather than only --format json:
-
It's a security boundary, not metadata. In a large org, repo-write access is not release authority: anyone who can push a workflow can produce attestations that still satisfy
--repoand--signer-workflow. Only the:environment:segment ofsubproves the run passed a GitHub Environment gate (required reviewers, prevent self-review) — the boundary a verifier actually needs to enforce. -
It isn't in the
--format jsonoutput. The parsedsignature.certificateexposessourceRepository*,buildSigner*,runnerEnvironment, andsubjectAlternativeName(the signer workflow URI, e.g..../deployment.yml@refs/heads/trunk) — but no field for the rawsub(Fulcio extension1.3.6.1.4.1.57264.1.24, "Token Subject") or the deployment environment (.1.23). Thesubis only reachable by DER-decodingattestation.bundle.verificationMaterial.certificate.rawByteswithopenssl, which a policy engine can't do from JSON. (Verified on gh v2.96.0.)
This mirrors GitHub's own guidance: cloud OIDC trust policies match on sub, and its immutable numeric-ID form is the recommended rename-resistant identity.
Proposal
-
Surface Token Subject (
.1.24), and ideally Deployment Environment (.1.23), undersignature.certificatein--format json, so--jqand policy engines can match without DER parsing. -
Add matcher flags paired with the existing
--cert-oidc-issuer:--cert-oidc-subject <value>--cert-oidc-subject-regex <pattern>
e.g.
--cert-oidc-subject-regex ':environment:release-stable$'. Matching the fullsubalso binds the source repo by immutable ID in a single value.
Workaround today
gh attestation verify my-artifact --repo my-org/my-repo --format json \
| jq -r '.[0].attestation.bundle.verificationMaterial.certificate.rawBytes' \
| base64 -d | openssl x509 -inform DER -noout -text \
| grep -A1 '57264\.1\.24' | tail -1 \
| grep -Fq ':environment:release-stable'
Activity
cli-triage commentedon Jul 21, 2026
This is a well-scoped enhancement request: it asks for
--cert-oidc-subject/--cert-oidc-subject-regexmatcher flags ongh attestation verify, and for the OIDCsub(Token Subject, Fulcio OID.1.24) and Deployment Environment (.1.23) to be surfaced in--format jsonoutput. No duplicate issues were found. Suggesting theenhancementlabel.github-actions commentedon Jul 21, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
kommendorkapten commentedon Jul 31, 2026
This makes sense when the subject is configured to a non-default value. The default value is
repo:OWNER/REPO:ref:REFwhich is exposed via other options during verification.For other formats of the subject like environment as you mentioned, having this optjon makes sense, I like this proposal.