Add issuer validation check whenever MSAL JS performs OIDC endpoint discovery#8570
Add issuer validation check whenever MSAL JS performs OIDC endpoint discovery#8570lalimasharda merged 38 commits intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR strengthens msal-common’s endpoint discovery by validating the issuer returned from network-fetched OIDC discovery documents, and adds supporting metadata/error surface updates.
Changes:
- Add a new
issuer_validation_failedClientConfigurationErrorCodesvalue and update the API review report. - Validate
metadata.issuerafter network OIDC discovery inAuthority.updateEndpointMetadata, introducingvalidateIssuerrules for Microsoft cloud/CIAM scenarios. - Extend hardcoded instance discovery metadata with
login.windows-ppe.net(PPE) aliases and add a beachball change file.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/msal-common/src/error/ClientConfigurationErrorCodes.ts | Adds new issuer_validation_failed error code constant. |
| lib/msal-common/src/authority/AuthorityMetadata.ts | Adds PPE instance discovery metadata aliases. |
| lib/msal-common/src/authority/Authority.ts | Calls issuer validation on network discovery results; adds validateIssuer implementation; minor log message tweak. |
| lib/msal-common/apiReview/msal-common.api.md | Updates API report to include the new error code. |
| change/@azure-msal-common-122605ed-d286-4abb-8312-feb6ede47a8d.json | Adds the required change file (patch). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tion-library-for-js into add_issuer_validation_v5
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/sessions/6659e7be-3af5-42b7-9b3d-56e3746e202a Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/sessions/310b1310-0a5d-4277-9447-63044386e35f Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
|
@copilot Can we create a helped method to convert any authority string into URL components and consolidate the selected lines |
…components helper Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/sessions/2a6f05ed-eae8-4b6f-a28e-4e8d1dbca18a Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
Added |
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/sessions/2a6f05ed-eae8-4b6f-a28e-4e8d1dbca18a Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
…character allocation Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/sessions/2a6f05ed-eae8-4b6f-a28e-4e8d1dbca18a Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
…tion-library-for-js into add_issuer_validation_v5
…/microsoft-authentication-library-for-js into add_issuer_validation_v5
…tion-library-for-js into add_issuer_validation_v5
This pull request adds issuer validation for OpenID Connect (OIDC) discovery in the
@azure/msal-commonpackage, ensuring that the issuer returned from the OIDC discovery document matches authority set by the application for security and correctness. It also introduces a new error code for issuer validation failures and updates internal metadata and documentation accordingly.OIDC Issuer Validation Enhancements:
validateIssuerprivate method to theAuthorityclass inAuthority.tsto enforce issuer validation based on OIDC and Microsoft-specific rules. This method checks that the issuer from the discovery document matches the authority or known Microsoft hosts, including support for regional and CIAM tenant patterns. If validation fails, aClientConfigurationErroris thrown.validateIssuermethod into the OIDC discovery flow within theAuthorityclass to ensure issuer validation is performed after discovery metadata is fetched.Error Handling and Codes:
issuerValidationFailedinClientConfigurationErrorCodesand exported it for use when issuer validation fails. [1] [2] [3]Metadata and Test Updates:
AuthorityMetadata.tsto support additional authority hosts.Documentation and API Review:
msal-common.api.md) to reflect the new error code, document the new method, and adjust line references for TSDoc warnings. [1] [2] [3]Release and Change Tracking: