OWASP Top 10 2021

The categories list for each CodeSonar warning includes any relevant members of the OWASP® Top Ten Application Security Risks - 2021.

CSV tables of warning classes by OWASP-2021 rule are provided in OWASP-2021-mapping.csv.



The OWASP Top 10 2021

"OWASP-2021" is shorthand for the OWASP Top 10 2021.

See the OWASP Top 10 2021 website for more information.

Relevant Warning Classes

The following table shows the CodeSonar warning classes that are associated with OWASP-2021 top ten security risks.

OWASP-2021 C/C++ Warning Classes Java Warning Classes C# Warning Classes Kotlin Warning Classes Python Warning Classes
OWASP-2021:A1 Broken access control - -
OWASP-2021:A2 Cryptographic failures - -
OWASP-2021:A3 Injection - -
OWASP-2021:A4 Insecure design - - - - -
OWASP-2021:A5 Security misconfiguration - -
OWASP-2021:A6 Vulnerable and outdated components - -
OWASP-2021:A7 Identification and authorization failures - -
OWASP-2021:A8 Software and data integrity failures - -
OWASP-2021:A9 Security logging and monitoring failures - - - -
OWASP-2021:A10 Server-side request forgery - - - - -

Management Reports

The predefined OWASP Top Ten 2021 Report management report template allows you to automatically generate a report summarizing all the warnings from a particular analysis that are closely mapped to one or more of the OWASP Top 10 2021.

You can generate this report from the GUI Analysis page for the analysis of interest. For general instructions, see Task: Generate a Management Report

Enabling OWASP-2021 Rules

Because the rules are strongly tied to web application development, many of the associated checks are disabled by default.

CodeSonar ships with a taxonomy preset for OWASP-2021 checks:

owasp2021 Enables warning classes such that a given class C is enabled if all of the following are true.
  • C is closely mapped to one or more OWASP-2021 members (that is, it appears in the table above), and
  • no other classes enabled by the preset are more closely related to the same rules, and
  • C is not diagnostic-only (that is, it does not have a DIAG.* mnemonic).

You can apply the owasp2021 preset to the CodeSonar build/analysis as shown in the following table.

Command Line Specify -preset owasp2021 as part of your build/analysis command. For example:
codesonar analyze MyProj -preset owasp2021 localhost:7340 make
Define as a default preset Copy owasp2021.conf from $CSONAR/codesonar/presets/ to $CSONAR/codesonar/default_presets/.
OR
Use the CodeSonar Configuration Tool Modify Analysis Settings option.
Windows Build Wizard Select owasp2021 from the Preset list on screen 2.
Eclipse Plug-In Select owasp2021 from the Presets list in the Properties dialog.
Visual Studio Plug-In Select owasp2021 from the Presets list in the Project Properties dialog.

Enabling checks for specific security risks

To enable checks for all the warning classes associated with a specific OWASP-2021 security risk, include the following in the project configuration file:

WARNING_FILTER += allow categories:"OWASP-2021:Anum"

Enabling individual warning classes

To enable a single warning class check, follow the instructions in the documentation for the corresponding warning class. Warning class documentation links are provided above.