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."

All Security Tools questions Roadmap: SonarQube — code quality & SAST

More on SonarQube