Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update anti-request-forgery.md #34449

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions aspnetcore/security/anti-request-forgery.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ Calling <xref:Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExten

## Multiple browser tabs and the Synchronizer Token Pattern

With the Synchronizer Token Pattern, only the most recently loaded page is guaranteed to contain a valid antiforgery token. Apps that wish to support multiple tabs should test supported browsers and log failures. ***Using multiple tabs can be problematic***. For example, if a user opens multiple tabs, requests made from previously loaded tabs might fail with an error: `Antiforgery token validation failed. The antiforgery cookie token and request token do not match`

Consider alternative CSRF protection patterns if this poses an issue.
Multiple tabs logged in as different users, or one logged in as anonymous, are not supported.
Copy link

@Tobikblom Tobikblom Jan 8, 2025

Choose a reason for hiding this comment

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

I would consider scrapping the "Multiple browser tabs and the Synchronizer Token Pattern" section altogether.

I don't see why it would make sense to log in as one user, open another tab and log in as another user, and then expect the other tab to still be in a valid state, nor do I see how this would be specific to antiforgery tokens.



## Configure antiforgery with `AntiforgeryOptions`

Expand Down
Loading