Repository navigation
Restart HttpListener authentication when protection policy changes - #136072
Merged
Merged
Conversation
Reject continuations from an incompatible in-progress authentication context with a fresh 401 challenge instead of passing them to a new context and returning 400. Preserve malformed-token mappings and require an NTLM restart challenge in the regression test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 783cf1e9-32b8-4d90-83d3-ab0f0644bf74
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
wfurt
reviewed
Oct 19, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 783cf1e9-32b8-4d90-83d3-ab0f0644bf74
This was referenced Oct 20, 2026
Member
Author
|
/ba-g test failures are unrelated |
wfurt
approved these changes
Oct 20, 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.
HttpListener currently returns 400 when its extended-protection selector changes policy between NTLM handshake legs. On Windows Server 2019 (RS5), the old context is discarded and its continuation token is passed to a fresh context, which returns
InvalidToken; the managed client-fault mapping then selects 400.Restart authentication with 401 and a fresh challenge when an in-progress, same-package context becomes policy-incompatible. Detach and dispose the old context rather than reusing its weaker policy. Fresh malformed-token mappings remain unchanged. The existing regression still requires successful Never/Never authentication and unauthenticated strict rejection, and now also requires a bare
WWW-Authenticate: NTLMrestart challenge.Validation
build.cmd clr+libs -rc releasepassed.dotnet build /t:test src\libraries\System.Net.HttpListener\tests\System.Net.HttpListener.Tests.csproj /p:RuntimeConfiguration=Releasepassed locally: 688 passed, 0 failed, 8 skipped. The credential-gated regression was skipped locally; malformed NTLM/Negotiate token cases retained their expected 400 responses.dotnet build src\libraries\System.Net.HttpListener\tests\System.Net.HttpListener.Tests.csproj /p:TestNativeAot=true /p:RuntimeConfiguration=Release /p:Optimize=true /p:OptimizationPreference=Sizepassed.System.Net.HttpListener.Tests.exe -method System.Net.Tests.HttpListenerAuthenticationTests.ExtendedProtectionSelectorDelegate_IncreasesPolicyBetweenNtlmLegs_AuthenticationFailsfailed before the fix with 400, then passed all 10 post-fix runs with no skips and a successful unchanged-policy control.System.Net.HttpListener.Tests.exe -notrait category=OuterLoop -notrait category=failing -xml C:\ntlm\native-after-suite.xmlpassed: 696 passed, 0 failed, 12 skipped.Resolves #135190
Note
This pull request description and code changes were generated with GitHub Copilot.