Skip to content

gh attestation verify: match the OIDC subject (sub) claim #13928

Open

Description

@yokonao

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:

  1. 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 --repo and --signer-workflow. Only the :environment: segment of sub proves the run passed a GitHub Environment gate (required reviewers, prevent self-review) — the boundary a verifier actually needs to enforce.

  2. It isn't in the --format json output. The parsed signature.certificate exposes sourceRepository*, buildSigner*, runnerEnvironment, and subjectAlternativeName (the signer workflow URI, e.g. .../deployment.yml@refs/heads/trunk) — but no field for the raw sub (Fulcio extension 1.3.6.1.4.1.57264.1.24, "Token Subject") or the deployment environment (.1.23). The sub is only reachable by DER-decoding attestation.bundle.verificationMaterial.certificate.rawBytes with openssl, 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

  1. Surface Token Subject (.1.24), and ideally Deployment Environment (.1.23), under signature.certificate in --format json, so --jq and policy engines can match without DER parsing.

  2. 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 full sub also 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'

Sources

Activity

  1. cli-triage commented on Jul 21, 2026

    @cli-triage

    This is a well-scoped enhancement request: it asks for --cert-oidc-subject / --cert-oidc-subject-regex matcher flags on gh attestation verify, and for the OIDC sub (Token Subject, Fulcio OID .1.24) and Deployment Environment (.1.23) to be surfaced in --format json output. No duplicate issues were found. Suggesting the enhancement label.

    Generated by Issue Triage (skills-driven) for #13928 · 20.2 AIC · ⌖ 4.92 AIC · ⊞ 5.1K · ◷

  2. github-actions commented on Jul 21, 2026

    @github-actions
    Contributor

    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 wanted Contributions 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.

  3. kommendorkapten commented on Jul 31, 2026

    @kommendorkapten
    Contributor

    This makes sense when the subject is configured to a non-default value. The default value is repo:OWNER/REPO:ref:REF which 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-attestationrelated to the gh attestation commandstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions