Add mTLS PoP validation for unsupported and non-login hosts #5684
Merged
Add mTLS PoP validation for unsupported and non-login hosts #5684
Conversation
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
…ison Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add error code for unsupported mTLS PoP hosts
Block mTLS PoP for unsupported sovereign cloud endpoints
Jan 28, 2026
gladjohn
reviewed
Jan 28, 2026
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Contributor
|
well done @copilot, I am marking this PR ready for review now. |
gladjohn
approved these changes
Jan 28, 2026
1 task
src/client/Microsoft.Identity.Client/Instance/Discovery/RegionAndMtlsDiscoveryProvider.cs
Outdated
Show resolved
Hide resolved
neha-bhargava
approved these changes
Jan 29, 2026
src/client/Microsoft.Identity.Client/Instance/Discovery/RegionAndMtlsDiscoveryProvider.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
Add mTLS PoP validation for unsupported and non-login hosts
Block mTLS PoP for unsupported sovereign hosts and enforce login.* prefix
Jan 30, 2026
…nore Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
Block mTLS PoP for unsupported sovereign hosts and enforce login.* prefix
Remove accidentally committed .mono build artifacts
Jan 30, 2026
gladjohn
approved these changes
Jan 30, 2026
trwalke
approved these changes
Jan 30, 2026
| @@ -0,0 +1,23 @@ | |||
| Build started 01/29/2026 14:27:45. | |||
Contributor
There was a problem hiding this comment.
Why is this file needed? Remove?
Copilot AI
added a commit
that referenced
this pull request
Jan 30, 2026
* Initial plan * Add mTLS PoP blocking for unsupported sovereign hosts Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Address code review feedback - improve error messages and host comparison Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Update public API files for new MsalError constant Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Refactor mTLS validation: use dictionary and move to fail-fast position Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Make error messages public and add validation for non-login hosts Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Revert error message constants from public to internal Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Change error message constants from internal to public for consistency Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Fix static field naming to follow s_camelCase convention Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Move Dictionary to using statement instead of fully qualified name Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Remove accidentally committed .mono build artifacts and update .gitignore Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com> * Delete mtls_pop_test_results.txt --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
1 task
This was referenced Feb 3, 2026
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.
Changes proposed in this request
This pull request adds robust validation and error handling for mTLS Proof-of-Possession (PoP) support in sovereign and non-standard cloud environments. It introduces explicit checks to prevent the use of unsupported hosts for mTLS PoP, provides clear error messages, and expands test coverage to ensure correct behavior.
Key changes include:
mTLS PoP Validation and Error Handling
login.usgovcloudapi.netandlogin.chinacloudapi.cn) to specific error messages, and implemented fail-fast logic inRegionAndMtlsDiscoveryProviderto throw a clear exception if these hosts are used. Also, enforced that mTLS PoP is only supported for hosts starting withlogin..MsalError.MtlsPopNotSupportedForEnvironmentand corresponding error messages for unsupported hosts and non-login.hosts. [1] [2]Public API Updates
MsalError.MtlsPopNotSupportedForEnvironmentto the public API surface for multiple target frameworks. [1] [2] [3]Test Coverage Improvements
login.hosts, ensuring correct error codes and messages are returned. [1] [2]Miscellaneous
using System.Collections.Generic;directive to support the new dictionary inRegionAndMtlsDiscoveryProvider.These changes make the library more robust and user-friendly by preventing misconfiguration and providing clear guidance when unsupported environments are used.
Testing
No functional changes. Verified clean working tree and successful build.
Performance impact
None. Repository cleanup only.
Documentation