Skip to content

anti-CSRF minor clarification about IsOriginAllowed - #37786

Merged
DeagleGross merged 8 commits into
dotnet:mainfrom
DeagleGross:deaglegross-csrf-cors-allowcredentials-docs
Oct 7, 2026
Merged

DeagleGross merged 8 commits into
dotnet:mainfrom
DeagleGross:deaglegross-csrf-cors-allowcredentials-docs

Conversation

@DeagleGross

@DeagleGross DeagleGross commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Notes the behavior of anti-CSRF around IsOriginAllowed.


Internal previews

File Preview link
aspnetcore/security/anti-request-forgery.md Learn preview

Build report

DeagleGross and others added 7 commits September 16, 2026 12:43
Contributes to dotnet/aspnetcore#69345

- security/anti-request-forgery.md: the automatic CSRF protection
  middleware's "How it works" and "Allowing cross-origin clients"
  sections now state that a CORS-allowed origin only grants CSRF trust
  when the policy also calls .AllowCredentials(). Updated the CORS code
  sample to include .AllowCredentials() so it stays a correct example,
  and added a short note next to the existing AllowAnyOrigin warning.
- migration/100-to-110/includes/security.md: one-line update to the
  CORS guidance bullet to mention the new AllowCredentials() requirement.
- breaking-changes/11/csrf-cors-allowcredentials-required.md: new
  breaking-change entry describing the behavior change, following the
  existing template. Registered in overview.md and toc.yml.

Co-authored-by: Copilot App <[email protected]>
Per feedback: the AllowCredentials() requirement for CORS-derived CSRF
trust is unreleased (dotnet/aspnetcore#69345 is still open), so it
shouldn't be documented as a breaking change or a 10->11 migration
concern yet.

- Removed breaking-changes/11/csrf-cors-allowcredentials-required.md
- Reverted the registration in breaking-changes/11/overview.md and toc.yml
- Reverted the migration/100-to-110/includes/security.md CORS bullet
- Removed the breaking-change cross-link from anti-request-forgery.md,
  keeping the AllowCredentials() requirement description, updated CORS
  code sample, and AllowAnyOrigin note

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	aspnetcore/security/anti-request-forgery.md
@DeagleGross DeagleGross self-assigned this Oct 7, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:27
@DeagleGross DeagleGross added the 11.0 .NET 11 label Oct 7, 2026
@DeagleGross
DeagleGross enabled auto-merge (squash) October 7, 2026 10:28

This comment was marked as resolved.

@guardrex guardrex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and will approve now for immediate merge (auto-merge is on), but I mention in passing that this seems to be a bit more of a warning than just a casual note.

@DeagleGross
DeagleGross merged commit 6374271 into dotnet:main Oct 7, 2026
5 checks passed
@guardrex

guardrex commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

... and btw ... just noticed that you marked this with the 11.0 label. Was this only for >=11.0? If so, I'll put a patch in to add versioning for it.

@DeagleGross

Copy link
Copy Markdown
Member Author

Ye, I wanted that to be included in net11 version. that line exists under 11 moniker, so it should be >=11.0 only right?

:::moniker range=">= aspnetcore-11.0"

@guardrex

guardrex commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

I see it now! 👀 We're good. Sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11.0 .NET 11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants