[WIP] Sec-Fetch-* based Antiforgery Version-2#66411
Draft
DeagleGross wants to merge 3 commits intodotnet:mainfrom
Draft
[WIP] Sec-Fetch-* based Antiforgery Version-2#66411DeagleGross wants to merge 3 commits intodotnet:mainfrom
DeagleGross wants to merge 3 commits intodotnet:mainfrom
Conversation
Lightweight, auto-enabled cross-origin request protection that works without AddAntiforgery()/UseAntiforgery() and has no DataProtection dependency — AOT/trim safe. Architecture: - ICrossOriginProtection + CrossOriginValidationResult in Http.Abstractions (namespace Microsoft.AspNetCore.Antiforgery for discoverability) - CrossOriginRequestValidator as shared source in src/Shared/ (compiled into Routing now, Antiforgery later) - CrossOriginProtectionOptions + DefaultCrossOriginProtection in Routing - EndpointMiddleware uses ICrossOriginProtection.Validate() with tri-state result (Allowed/Denied/Disabled) instead of throwing on missing middleware Algorithm (matches Go 1.25 CrossOriginProtection): 1. Safe methods (GET/HEAD/OPTIONS/TRACE) → allow 2. Trusted origins → allow 3. Sec-Fetch-Site same-origin/none → allow, cross-site → deny 4. Origin vs request host fallback 5. No headers (non-browser) → allow Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 task
3 tasks
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.
[IN DESIGN]
Fixes #65127