Conversation
bgavrilMS
approved these changes
Dec 18, 2025
Contributor
|
What is the difference between this issuer validation and the one in this older PR? #840 Also, back when we did this validation for the other MSALs we had to consider the special case CIAM custom domains: a customer could set up |
Author
|
@Avery-Dunn I hadn’t noticed that before—thank you for pointing it out. |
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.
Add OIDC Issuer Validation for Enhanced Security
Problem
When using OIDC authority URLs, MSAL Python was not validating the
issuerclaim from the OIDC discovery response. Per the OpenID Connect Discovery specification, the issuer returned in the discovery document should be validated. Without this validation, applications could be vulnerable to accepting tokens from unauthorized identity providers.Solution
Added issuer validation when initializing an authority with
oidc_authority_url:New
TRUSTED_ISSUER_HOSTSconstant - A frozenset of well-known Microsoft identity provider hosts:login.microsoftonline.com,login.microsoft.com,login.windows.net,sts.windows.netlogin.chinacloudapi.cn,login.partner.microsoftonline.cn,login.microsoftonline.de,login.microsoftonline.us,login.usgovcloudapi.net,login-us.microsoftonline.comNew
_validate_issuer()function - Validates the issuer claim with O(1) lookups:westus2.login.microsoft.comValidation is called only for OIDC authorities - Standard Entra authorities continue to work without additional validation
Files Changed
msal/authority.py- AddedTRUSTED_ISSUER_HOSTS,_validate_issuer()function, and validation callBreaking Changes
Applications using
oidc_authorityparameter will now require the OIDC discovery response to include a validissuerclaim that either: