Skip to main content

Configuration

Overriding severity

Every rule's severity can be overridden in an .editorconfig file in your project or solution root:

[*.cs]
dotnet_diagnostic.<RuleId>.severity = <level>

Valid severity levels:

LevelEffect
errorBreaks the build
warningShown as a warning, does not break the build
suggestionShown as a suggestion/hint in the IDE
silentRuns the analyzer but hides results
noneDisables the rule entirely

Suppressing a single occurrence

Use #pragma to suppress a specific diagnostic on a line:

#pragma warning disable OWASPA01001
[HttpGet]
public IActionResult PublicEndpoint() => Ok();
#pragma warning restore OWASPA01001

Or use the [SuppressMessage] attribute:

[System.Diagnostics.CodeAnalysis.SuppressMessage("Security", "OWASPA01001")]
public IActionResult PublicEndpoint() => Ok();

Full rule reference

Rule IDCategoryDefault SeverityDescription
OWASPA01001A01 Broken Access ControlWarningController action missing authorization attribute
OWASPA01002A01 Broken Access ControlWarningHardcoded role string in [Authorize]
OWASPA01003A01 Broken Access ControlWarningIsInRole called with hardcoded string
OWASPA01004A01 Broken Access ControlWarningCORS AllowAnyOrigin (wildcard)
OWASPA01005A01 Broken Access ControlWarningPOST/PUT/DELETE action missing antiforgery token
OWASPA01006A01 Broken Access ControlErrorSSRF via HttpClient (taint analysis)
OWASPA01007A01 Broken Access ControlErrorSSRF via WebClient (taint analysis)
OWASPA01008A01 Broken Access ControlWarningAllowAutoRedirect without URL validation
OWASPA02001A02 Security MisconfigurationWarningDeveloper exception page enabled unconditionally
OWASPA02002A02 Security MisconfigurationWarningMissing HTTPS redirection
OWASPA02003A02 Security MisconfigurationWarningDirectory browsing enabled
OWASPA02004A02 Security MisconfigurationWarningError details exposed to client
OWASPA02005A02 Security MisconfigurationWarningAntiforgery services not configured
OWASPA02006A02 Security MisconfigurationErrorHardcoded credential in source code
OWASPA03001A03 Software Supply Chain FailuresWarningKnown-vulnerable NuGet package reference
OWASPA03002A03 Software Supply Chain FailuresWarningDeprecated or end-of-life NuGet package
OWASPA04001A04 Cryptographic FailuresWarningWeak hashing algorithm (MD5 / SHA1)
OWASPA04002A04 Cryptographic FailuresWarningECB cipher mode
OWASPA04003A04 Cryptographic FailuresInfoSystem.Random used (not cryptographically secure)
OWASPA04004A04 Cryptographic FailuresErrorHardcoded cryptographic key or IV
OWASPA04005A04 Cryptographic FailuresWarningLegacy TLS protocol (SSL2/3, TLS 1.0/1.1)
OWASPA04006A04 Cryptographic FailuresErrorCertificate validation disabled
OWASPA04007A04 Cryptographic FailuresWarningHTTP URL used (not HTTPS)
OWASPA04008A04 Cryptographic FailuresWarningHSTS not configured alongside HTTPS redirection
OWASPA05001A05 InjectionErrorSQL injection (taint analysis)
OWASPA05002A05 InjectionErrorOS command injection (taint analysis)
OWASPA05003A05 InjectionErrorPath traversal (taint analysis)
OWASPA05004A05 InjectionErrorLDAP injection (taint analysis)
OWASPA05005A05 InjectionErrorXPath injection (taint analysis)
OWASPA05006A05 InjectionErrorXSS via unencoded output (taint analysis)
OWASPA06001A06 Insecure DesignWarningMissing rate limiting on authentication endpoints
OWASPA07001A07 Authentication FailuresErrorJWT signed with SecurityAlgorithms.None
OWASPA07002A07 Authentication FailuresWarningJWT lifetime validation disabled
OWASPA07003A07 Authentication FailuresErrorJWT signing key validation disabled
OWASPA07004A07 Authentication FailuresWarningCookie missing HttpOnly or Secure flag
OWASPA07005A07 Authentication FailuresWarningCookie SameSite=None without Secure
OWASPA08001A08 Software or Data Integrity FailuresErrorBinaryFormatter usage
OWASPA08002A08 Software or Data Integrity FailuresErrorNetDataContractSerializer / SoapFormatter usage
OWASPA08003A08 Software or Data Integrity FailuresErrorTypeNameHandling not None in Newtonsoft.Json
OWASPA08004A08 Software or Data Integrity FailuresErrorJavaScriptSerializer with SimpleTypeResolver
OWASPA09001A09 Security Logging and Alerting FailuresWarningLog injection via user-controlled input (taint analysis)
OWASPA09002A09 Security Logging and Alerting FailuresWarningSensitive data keyword in log message
OWASPA10001A10 Mishandling of Exceptional ConditionsWarningEmpty catch block (swallowed exception)
OWASPA10002A10 Mishandling of Exceptional ConditionsWarningCatch block without logging

Example .editorconfig

# .editorconfig at solution root
root = true

[*.cs]
# Treat all OWASP rules as errors
dotnet_diagnostic.OWASPA01001.severity = error
dotnet_diagnostic.OWASPA01004.severity = error

# Downgrade informational rules to silent
dotnet_diagnostic.OWASPA04003.severity = silent

# Suppress deprecated package rule (we track upgrades in a separate process)
dotnet_diagnostic.OWASPA03002.severity = none