What is the difference between a bug, a vulnerability and a security hotspot in SonarQube?
IntermediateConceptSonarQube
Answer
Short answer
A bug is code that will probably behave incorrectly. A vulnerability is code that is definitely exploitable and must be fixed. A security hotspot is security-sensitive code that might be fine or might be a problem — a human has to review it and mark it safe or fix it.
Examples
| Type | Example | Action |
|---|---|---|
| Bug | if (str == "yes") in Java (compares references) |
Fix |
| Vulnerability | "SELECT * FROM users WHERE id=" + request.getParameter("id") |
Fix (SQL injection) |
| Hotspot | new Random() used for tokens; MessageDigest.getInstance("MD5"); CORS allowing * |
Review: safe in this context? |
Hotspot review flow
SonarQube → Security Hotspots tab → for each: Safe / Fixed / Acknowledged. The default quality gate requires 100% of new hotspots reviewed.
What to say in the interview
"Bugs are reliability defects, vulnerabilities are confirmed security flaws to fix, and hotspots are security-sensitive code needing human review because context decides whether it's risky. Our gate requires all new hotspots to be reviewed."
More on SonarQube
What is SonarQube and how do you integrate it into a pipeline?BeginnerWhat does SonarQube analyse?BeginnerHow do you run SonarQube locally with Docker?BeginnerHow do you scan a project with sonar-scanner?BeginnerHow do you run SonarQube analysis for a Maven project?BeginnerWhat is a quality gate in SonarQube?Beginner