How to SupressWarnings for Sonar Security Hotspots?

发布时间 2023-09-19 10:16:36作者: ChuckLu

How to SupressWarnings for Sonar Security Hotspots?

Sonarlint/SonarQube allows you to use comments for disabling analysis in specific lines. In order to do this, you can just add a comment with the text NOSONAR in the same line:

Random rand=new Random();//NOSONAR not used in secure contexts

Aside from this, you can mark Security Hotspots as resolved in the web Dashboard of SonarQube. In order to do this, you need to navigate to the Security Hotspot and mark it as not an issue. You might even want to disable that specific type of Security Hotspot entirely if it is generally not applicable for your project.