Skip to content

Validate the client audience of OpenID Connect ID tokens - #391

Merged
vharseko merged 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:fix-oidc-client-audience
Nov 24, 2026
Merged

vharseko merged 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:fix-oidc-client-audience

Conversation

@vharseko

@vharseko vharseko commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Validate an ID token's audience against the client ID configured for the selected issuer.
  • Require client_id for each resolver and validate azp when the token supplies it.
  • Cover discovery-backed resolver selection with a signed ID token and document the configuration change for upgrades.

Upgrade note

Before upgrading, set the registered OpenID Connect client ID as a nonblank client_id in every resolvers entry, including entries that use well-known discovery. A missing, blank, or non-string value in any entry prevents the module from initializing.

Verification

  • The current revision passed all 68 OpenID Connect tests on JDK 21 as part of a 20-module Maven reactor run.
  • The new discovery test failed as expected when the resolver was temporarily indexed by the configured issuer field.
  • On the initial revision, Maven verify covered all 103 reactor modules across separate runs. The active profile skipped the embedded Cassandra tests.

@vharseko vharseko added bug java Pull requests that update java code labels Nov 22, 2026
@vharseko
vharseko requested a review from maximthomas November 22, 2026 16:33

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: The audience tests exercise both issuer-to-client bindings and check that rejected requests never publish a principal.


suggestion (non-blocking): Cover discovery-backed audience binding at the module boundary.

OpenIdConnectModuleTest.java:328

The new request tests configure explicit issuers with shared secrets. The existing discovery tests exercise the configurator, resolver service, or factory independently. A future change that indexes the module's resolver by the configured issuer field could break discovery-backed initialization or requests while leaving these tests green.

Pin the module contract with a controlled discovery fixture. Configure a resolver with well-known and client_id and omit issuer. Assert SUCCESS and principal publication for a valid ID token with the discovered issuer and configured audience. Issuer binding in the module.


suggestion (non-blocking): Document the required configuration change for upgrades.

OpenIdConnectModule.java:189

A resolver entry without client_id could initialize on the base revision. On this revision, any such entry fails module initialization. Add an upgrade note to the auth-filters changelog or release notes telling operators to set the registered, nonblank client_id in each resolvers entry before upgrading, including entries that use discovery.

@vharseko

Copy link
Copy Markdown
Member Author

@maximthomas, I addressed both suggestions in f49727d.

  • The new module test uses local discovery and JWKS endpoints. It configures well-known and client_id, omits issuer, and checks successful authentication and the principal callback for a valid signed ID token.
  • The auth-filters changelog documents the requirement to set the registered client_id in every resolver before upgrading, including resolvers configured through discovery.

All 68 OpenID Connect tests passed on JDK 21 as part of a 20-module Maven reactor run.

@vharseko vharseko added security Security fixes and CVE remediation documentation Documentation and Javadoc changes tests Test code changes labels Nov 23, 2026
@vharseko
vharseko requested a review from maximthomas November 23, 2026 08:08

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: The discovery test exercises JWKS retrieval and RSA signature verification through the module, then checks the principal name and subject in the callback.

@vharseko
vharseko merged commit 7785726 into OpenIdentityPlatform:master Nov 24, 2026
14 checks passed
@vharseko
vharseko deleted the fix-oidc-client-audience branch November 24, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug documentation Documentation and Javadoc changes java Pull requests that update java code security Security fixes and CVE remediation tests Test code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants