Skip to content

Mention automatic CSRF protection in .NET 10 -> 11 migration article#37329

Open
DeagleGross wants to merge 2 commits into
dotnet:mainfrom
DeagleGross:deaglegross-silver-memory
Open

Mention automatic CSRF protection in .NET 10 -> 11 migration article#37329
DeagleGross wants to merge 2 commits into
dotnet:mainfrom
DeagleGross:deaglegross-silver-memory

Conversation

@DeagleGross

@DeagleGross DeagleGross commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adds a short mention of the new automatic CSRF protection in .NET 11 to the .NET 10 -> 11 migration article, so readers upgrading find the pointer during the usual migration walkthrough.

Follows the include pattern the article already uses for Blazor. Content:

  • What changed: WebApplication.CreateBuilder now wires up automatic CSRF protection middleware that inspects Sec-Fetch-Site / Origin and records a verdict on the request.
  • Impact: same-origin browser traffic, safe methods, and non-browser clients (curl / mobile / server-to-server) pass through. Cross-origin form posts from a browser now get 400 unless the origin is trusted.
  • What to do: configure CORS or call .DisableAntiforgery() on the endpoint.
  • Links to <xref:security/csrf-protection> and <xref:migration/antiforgery-to-csrf> for the full picture.

Related feature PRs:

Opening as draft for review.


Internal previews

📄 File 🔗 Preview link
aspnetcore/migration/100-to-110.md Migrate from ASP.NET Core in .NET 10 to ASP.NET Core in .NET 11

DeagleGross and others added 2 commits July 10, 2026 09:52
Adds a short "Security" section pointing readers at
<xref:security/csrf-protection> and <xref:migration/antiforgery-to-csrf>.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Splits the guidance into "already uses AddAntiforgery/UseAntiforgery"
vs "doesn't configure antiforgery explicitly", then covers opt-out and
CORS in a single follow-up paragraph.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DeagleGross DeagleGross marked this pull request as ready for review July 10, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants