Skip to content

Add OIDC issuer validation - #840

Merged
Bogdan Gavril (bgavrilMS) merged 11 commits into
devfrom
avdunn/issuer-validation
Feb 19, 2026
Merged

Add OIDC issuer validation#840
Bogdan Gavril (bgavrilMS) merged 11 commits into
devfrom
avdunn/issuer-validation

Conversation

@Avery-Dunn

@Avery-Dunn Avery-Dunn commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

Adds new validation according to: https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3268768

The issuer returned by the call to the OIDC endpoint (.well-known/openid-configuration) is valid if one of the following is true:

  • It exactly matches the authority URL
  • It has a known Microsoft host (e.g., login.microsoftonline.com)
  • It has the same scheme and host as the authority (path can be different)
  • For CIAM, the issuer follows the pattern of {tenant}.ciamlogin.com, even when using a custom domain

The validation behavior was added to authority.py, and new tests were added to test_authority.py to cover it

In addition, a few other tests in test_authority.py and test_application.py were given valid issuers in their mocked OIDC discovery responses in order to pass validation, but were otherwise unchanged.

(this is the full implementation of the work started in this draft PR: #830)

@Avery-Dunn
Avery-Dunn requested a review from a team as a code owner July 18, 2025 21:32
Comment thread msal/authority.py

@rayluo Ray Luo (rayluo) 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.

We are discussing in this offline conversation on Teams.

Comment thread tests/test_authority.py
@bgavrilMS

Copy link
Copy Markdown
Member

Ray Luo (@rayluo) - any updates on this?

@Avery-Dunn

Copy link
Copy Markdown
Contributor Author

Ray Luo (@rayluo) Any updates on this? A while back you had some behaviors you wanted to confirm or edge cases you wanted to test, and Nilesh Choudhary (@4gust) updated this PR to handle validating region-specific endpoints, but I can't remember what was still blocking this.

Comment thread msal/authority.py
Comment thread msal/authority.py Outdated
Comment thread msal/authority.py

@bgavrilMS Bogdan Gavril (bgavrilMS) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need another rule for regiona.

@bgavrilMS
Bogdan Gavril (bgavrilMS) merged commit d7e0e11 into dev Feb 19, 2026
22 checks passed
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