Skip to content

Improve validation of "jku" claim (7.x)#3480

Open
alexholub113 wants to merge 2 commits into
AzureAD:dev7xfrom
alexholub113:alexholub/improve-validation-of-jku-claim
Open

Improve validation of "jku" claim (7.x)#3480
alexholub113 wants to merge 2 commits into
AzureAD:dev7xfrom
alexholub113:alexholub/improve-validation-of-jku-claim

Conversation

@alexholub113
Copy link
Copy Markdown
Contributor

Currently, when validating the "jku" claim against the list from AllowedDomainsForJkuRetrieval we use Host.EndsWith for the string comparison, allowing invalid domains like "wrongcontoso.com" to bypass restrictions intended for "contoso.com"

This PR improves the validation by updating the domain matching to require either:

  • An exact match
  • A proper subdomain (dot-bounded) match

This is a cherry-pick of commit 6cec324 from dev to dev7x.

Files changed:

  • src/Microsoft.IdentityModel.Protocols.SignedHttpRequest/SignedHttpRequestHandler.cs
  • test/Microsoft.IdentityModel.Protocols.SignedHttpRequest.Tests/PopKeyResolvingTests.cs

@alexholub113 alexholub113 requested a review from a team as a code owner May 8, 2026 23:04
@alexholub113 alexholub113 requested a review from kllysng May 8, 2026 23:07
@alexholub113 alexholub113 assigned alexholub113 and unassigned kllysng May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants