Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request ensures that issued JWTs always contain an "aud" claim by defaulting to the issuer URL when no audience is specified, satisfying JWT-SVID §3 requirements. Integration tests have been added to verify both the default behavior and the preservation of explicit audiences. A review comment identifies a potential issue where the "RotateCredential" method may now incorrectly default the audience for rotated tokens instead of preserving the original audience, which could impact client interoperability.
saucam
approved these changes
Apr 22, 2026
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
Tokens issued without an explicit audience had no
audclaim at all.internal/service/credential.goonly set the claim inside
if len(req.Audience) > 0. This:audon every issued token)pkg/authjwtclient whenconfigured with an expected audience
Fix
Default
audto the issuer URL when the caller does not supply one. Every grant routes throughCredentialService.IssueCredential, so a single change covers all paths (client_credentials,jwt_bearer,token_exchange,api_key,authorization_code,refresh_token).Explicit audiences (set via the admin /credentials/issue endpoint) are preserved; the default only fills the empty case.
Tests
New file tests/integration/jwt_svid_aud_test.go:
Test plan