C#-CWE-352ΒΆ
Public controller methods that change state (POST/PUT/DELETE) must enforce CSRF validation
Required inputs: CSharpAST
[ValidateAntiForgeryToken]
[HttpPost]
public IActionResult SubmitForm(MyModel model)
{
// protected code
return Ok();
}
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
csrf_missing_validation |
State-changing controller method is missing CSRF validation. Add [ValidateAntiForgeryToken]. |
None |
False |
Options
This rule shares the following common options: excludes, includes, justification_checker, post_processing, provider, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.