Reject control characters in local redirect URL validation - #4028
Merged
Bogdan Gavril (bgavrilMS) merged 4 commits intoSep 14, 2026
Merged
Conversation
Neha Bhargava (neha-bhargava)
requested a review
from a team
as a code owner
September 4, 2026 06:22
Neha Bhargava (neha-bhargava)
requested a review
from Ignacio Inglese (iNinja)
September 4, 2026 06:22
Iarek Kovtunenko (iarekk)
force-pushed
the
nebharg/fix-664506-redirect-control-char
branch
from
September 14, 2026 11:15
d93ecb0 to
d56086c
Compare
Bogdan Gavril (bgavrilMS)
approved these changes
Sep 14, 2026
Bogdan Gavril (bgavrilMS)
force-pushed
the
nebharg/fix-664506-redirect-control-char
branch
from
September 14, 2026 13:55
d56086c to
6e73b79
Compare
Bogdan Gavril (bgavrilMS)
enabled auto-merge (squash)
September 14, 2026 14:59
RedirectUriHelper.IsLocalUrl and the AccountController SignIn/Challenge redirect checks accepted paths containing raw ASCII control characters (e.g. tab/CR/LF). Browsers strip these per the WHATWG URL spec, so a value like "/<tab>/host" resolves to a protocol-relative URL after stripping and was treated as local. Add a HasControlCharacter guard (rejects C0 range and DEL) so the library enforces this independent of the host's ASP.NET Core version. Internal/private helpers only; no public API change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e64c3d8c-4f86-4d0b-ac12-0da2e2d44a5b
Combine the AccountController redirect checks, simplify helper documentation, correct the control-character example, and clarify the legacy framework behavior modeled by the tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e64c3d8c-4f86-4d0b-ac12-0da2e2d44a5b
Document that percent-encoded slash checks use case-insensitive hexadecimal comparison as defined by RFC 3986. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e64c3d8c-4f86-4d0b-ac12-0da2e2d44a5b
Explain the redirect risk in plain language without relying on standards terminology. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e64c3d8c-4f86-4d0b-ac12-0da2e2d44a5b
Bogdan Gavril (bgavrilMS)
force-pushed
the
nebharg/fix-664506-redirect-control-char
branch
from
September 14, 2026 14:59
6e73b79 to
76ff5ff
Compare
Bogdan Gavril (bgavrilMS)
deleted the
nebharg/fix-664506-redirect-control-char
branch
September 14, 2026 15:16
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.
RedirectUriHelper.IsLocalUrl and the AccountController SignIn/Challenge redirect checks accepted paths containing raw ASCII control characters (e.g. tab/CR/LF). Browsers strip these per the WHATWG URL spec, so a value like "//host" resolves to a protocol-relative URL after stripping and was treated as local. Add a HasControlCharacter guard (rejects C0 range and DEL) so the library enforces this independent of the host's ASP.NET Core version. Internal/private helpers only; no public API change.
{PR title}
Summary of the changes (Less than 80 chars)
Description
{Detail}
Fixes #{bug number} (in this specific format)