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

SEC0019 with global AutoValidateAntiforgeryTokenAttribute #37

Open
felickz opened this issue Oct 11, 2017 · 1 comment
Open

SEC0019 with global AutoValidateAntiforgeryTokenAttribute #37

felickz opened this issue Oct 11, 2017 · 1 comment

Comments

@felickz
Copy link

felickz commented Oct 11, 2017

A newer pattern exists for auto validating CSRF tokens in .NET Core to protect all endpoints through global filter configuration. Is there any pattern for detecting this attribute is globally applied and disable SEC0019? Potentially here SEC0019 could apply to the use of the ignore attribute.

Filters.Add(new AutoValidateAntiforgeryTokenAttribute());

AutoValidateAntiforgeryTokenAttribute can be applied as a global filter to trigger validation of antiforgery tokens by default for an application.

Also, we should call out the usage of IgnoreAntiforgeryTokenAttribute here.

Blog explaining the topic: https://andrewlock.net/automatically-validating-anti-forgery-tokens-in-asp-net-core-with-the-autovalidateantiforgerytokenattribute/

This would be dependent on .NET Core support #36

@felickz felickz changed the title Globally disable SG0016 Controller method is vulnerable to CSRF when using AutoValidateAntiforgeryTokenAttribute in .NET Core remove me! Oct 11, 2017
@felickz felickz closed this as completed Oct 11, 2017
@felickz felickz changed the title remove me! remove me Oct 11, 2017
@felickz felickz changed the title remove me SEC0019 with global AutoValidateAntiforgeryTokenAttribute Oct 11, 2017
@felickz felickz reopened this Oct 11, 2017
@ejohn20
Copy link
Member

ejohn20 commented Oct 17, 2017

Agreed, this will need to be part of the .NET Core rule package.

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

No branches or pull requests

2 participants