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
OWASPA02001A02 Cryptographic FailuresWarningWeak hashing algorithm (MD5 / SHA1)
OWASPA02002A02 Cryptographic FailuresWarningECB cipher mode
OWASPA02003A02 Cryptographic FailuresInfoSystem.Random used (not cryptographically secure)
OWASPA02004A02 Cryptographic FailuresErrorHardcoded cryptographic key or IV
OWASPA02005A02 Cryptographic FailuresWarningLegacy TLS protocol (SSL2/3, TLS 1.0/1.1)
OWASPA02006A02 Cryptographic FailuresErrorCertificate validation disabled
OWASPA02007A02 Cryptographic FailuresWarningHTTP URL used (not HTTPS)
OWASPA02008A02 Cryptographic FailuresWarningHSTS not configured alongside HTTPS redirection
OWASPA03001A03 InjectionErrorSQL injection (taint)
OWASPA03002A03 InjectionErrorOS command injection (taint)
OWASPA03003A03 InjectionErrorPath traversal (taint)
OWASPA03004A03 InjectionErrorLDAP injection (taint)
OWASPA03005A03 InjectionErrorXPath injection (taint)
OWASPA03006A03 InjectionErrorXSS via unencoded output (taint)
OWASPA04002A04 Insecure DesignWarningMissing rate limiting on authentication endpoints
OWASPA05001A05 Security MisconfigurationWarningDeveloper exception page enabled unconditionally
OWASPA05002A05 Security MisconfigurationWarningDirectory browsing enabled
OWASPA05003A05 Security MisconfigurationWarningDetailed errors exposed to client
OWASPA05004A05 Security MisconfigurationWarningSwagger enabled in production
OWASPA05005A05 Security MisconfigurationWarningHTTP logging with sensitive headers
OWASPA05006A05 Security MisconfigurationErrorHardcoded credential in source code
OWASPA06001A06 Vulnerable ComponentsWarningKnown-vulnerable NuGet package reference
OWASPA06002A06 Vulnerable ComponentsWarningDeprecated or end-of-life NuGet package
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 Data Integrity FailuresErrorBinaryFormatter usage
OWASPA08002A08 Data Integrity FailuresErrorNetDataContractSerializer / SoapFormatter usage
OWASPA08003A08 Data Integrity FailuresErrorTypeNameHandling not None in Newtonsoft.Json
OWASPA08004A08 Data Integrity FailuresErrorJavaScriptSerializer with SimpleTypeResolver
OWASPA09001A09 Logging FailuresWarningEmpty catch block (swallowed exception)
OWASPA09002A09 Logging FailuresWarningCatch block without logging
OWASPA09003A09 Logging FailuresWarningLog injection via user-controlled input (taint)
OWASPA09004A09 Logging FailuresWarningSensitive data keyword in log message
OWASPA10001A10 SSRFErrorSSRF via HttpClient (taint)
OWASPA10002A10 SSRFErrorSSRF via WebClient (taint)
OWASPA10003A10 SSRFWarningAllowAutoRedirect without URL validation

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.OWASPA02003.severity = silent

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