Fix #3785#3792
Merged
Merged
Conversation
bgavrilMS
approved these changes
Apr 24, 2026
F1 (Microsoft.Identity.Web.UI / AccountController.Challenge): - Reject redirectUri values that pass Url.IsLocalUrl() but decode to a protocol-relative form (leading %2F%2F...), which Cookie auth would emit verbatim in Location and some clients decode to //host before following. New IsPercentEncodedSlashBypass helper runs after both raw input and Uri-coerced candidate. F3 (Microsoft.Identity.Web / MapLoginAndLogout): - Remove .DisableAntiforgery() from /logout. - Add .RequireAuthorization() as primary CSRF gate. - Validate IAntiforgery.IsRequestValidAsync(context) in the handler when IAntiforgery is registered, independent of whether UseAntiforgery() middleware is in the pipeline. Makes /logout pipeline-shape-agnostic (Blazor, MVC, minimal-API hosts all get equivalent protection). - When IAntiforgery is not registered, log a one-time warning at MapLoginAndLogout time (EventId=1, AntiforgeryNotRegistered) so operators can see the graceful-degradation state; RequireAuthorization + SameSite=Lax cookies remain as the gate. Tests: - F1: 44/44 on net8/net9 (16 unit + 28 integration). - F3: 22/22 on net8/net9/net10 (16 unit + 6 integration including MVC-shape graceful-degradation coverage). Reviewed independently by two models (both passes sign-off). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fb75e27 to
52a97fe
Compare
Member
|
Tested manually, LGTM. Thanks @jmprieur |
This was referenced May 1, 2026
Closed
Merged
This was referenced May 17, 2026
Closed
This was referenced May 24, 2026
Merged
Closed
Closed
Open
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.
Fixes #3785
(Microsoft.Identity.Web.UI / AccountController.Challenge):
(Microsoft.Identity.Web / MapLoginAndLogout):
Fixes #3785