Skip to content

feat:(oidc) derive audience claim from client_id in IdentityToken #1402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 29, 2025

Conversation

SequeI
Copy link
Contributor

@SequeI SequeI commented May 21, 2025

Summary

Resolves #1401

This change updates the OIDC identity token handling to derive the audience (aud) claim from the provided client_id and defaulting to _DEFAULT_CLIENT_ID elsewise. Essentially mimicking Fulcio config behaviour

hatch run python -m sigstore --trust-config trust_config.json sign \
--oidc-client-id=<ClientID> \
--oauth-force-oob --overwrite --verbose test.txt
hatch run python -m sigstore --trust-config trust_config.json verify identity \
--cert-identity=<Identity> --cert-oidc-issuer <customIssuer> --verbose test.txt

Signed and verified using a custom Sigstore instance alongside a custom OIDC client and all worked.

Release Note

  • derive audience claim from client_id in IdentityToken

Documentation

None

@SequeI SequeI force-pushed the audClaim branch 3 times, most recently from 194101d to 6fc943c Compare May 22, 2025 10:10
@SequeI SequeI changed the title feat: adding --oidc-audience (aud) claim configuration options feat:(oidc) derive audience claim from client_id in IdentityToken May 22, 2025
Copy link
Member

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I mentioned I'm not fully versed on this oidc business but this makes sense to me.

  • IdentityToken is public so adding a constructor argument is a minor api change
  • this IdentityToken change seems to have broken some tests

Signed-off-by: SequeI <[email protected]>
@SequeI
Copy link
Contributor Author

SequeI commented May 28, 2025

Huh, I had to do a bunch of linting changes to make it pass. I assume it was bumped recently or something. Odd.

Signed-off-by: SequeI <[email protected]>
@SequeI SequeI requested review from jku and woodruffw May 28, 2025 16:06
@jku
Copy link
Member

jku commented May 29, 2025

The check-readme lint is annoying, sorry about that: the result depends slightly on specific Python version if I recall correctly: if you get a different result locally with make check-readme, I think the best you can do is to try to copy-paste the result that the CI expects: https://github.com/sigstore/sigstore-python/actions/runs/15303271381/job/43098226519.

test/unit/test_oidc.py seems to still have several cases of IdentityToken() that need to be updated to the new API (unless a default value is added for client_id there as well).

@jku
Copy link
Member

jku commented May 29, 2025

if you get a different result locally with make check-readme, I think the best you can do is to try to copy-paste the result that the CI expects: https://github.com/sigstore/sigstore-python/actions/runs/15303271381/job/43098226519.

Actually, now that --oidc-client-id default does not change... I wouldn't expect required changes in README anymore at all.

SequeI added 2 commits May 29, 2025 10:05
Signed-off-by: SequeI <[email protected]>
Signed-off-by: SequeI <[email protected]>
@SequeI
Copy link
Contributor Author

SequeI commented May 29, 2025

Made some changes, hopefully it passes ci..... Also tested with our own private OIDC aud claim and works as it should.

Signed-off-by: SequeI <[email protected]>
@SequeI
Copy link
Contributor Author

SequeI commented May 29, 2025

I was looking at the wrong detect_credentials() since one is just a wrapper for the id.detect_credentials 😅

@woodruffw woodruffw added component:signing Core signing functionality component:api Public APIs labels May 29, 2025
@SequeI SequeI requested a review from woodruffw May 29, 2025 15:41
@woodruffw
Copy link
Member

/gcbrun

@@ -18,13 +18,15 @@

from sigstore import oidc

TEST_CLIENT_ID = "sigstore"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this (and the uses below) can be removed now that we have a proper kwarg default in place, right?

@woodruffw
Copy link
Member

Thanks @SequeI! This looks good to me; one last test nitpick and we're good to go 🙂

@woodruffw
Copy link
Member

/gcbrun

@woodruffw woodruffw merged commit 33e2765 into sigstore:main May 29, 2025
23 checks passed
@woodruffw
Copy link
Member

Thanks @SequeI!

@SequeI
Copy link
Contributor Author

SequeI commented May 29, 2025

@woodruffw Huh, the commit failed some tests. Seems like the regular CI skips all ambient credential tests on PR's for some reason. Is there some easy way to test this locally so I can fix my mistake? (Since I caused it 😅 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api Public APIs component:signing Core signing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signing: hardcoded audience value won't allow a custom sigstore clients audience claim
3 participants