Chapter 15Lesson 04~125 minutes

Security Hotspots, Vulnerabilities, Taint Analysis, and Review Workflow: Diagnostics, Failure Modes, and Production Practices

Diagnose security-analysis failures without hiding evidence, downgrading policy, disabling TLS, leaking secrets, or assuming a clean scanner result proves security.

SecurityVulnerabilitiesHotspot reviewTaint analysisGovernance

Learning objectives

  • Use an evidence-first diagnostic sequence for scanner, finding, review, edition, and migration failures.
  • Recognize unsafe shortcuts such as suppressing findings, leaking secrets, disabling TLS, or attacking public targets.
  • Diagnose a deliberately misleading “no hotspot found” case without assuming the code is secure.
  • Separate analyzer capability, policy configuration, source scope, Compute Engine processing, and UI/API migration layers.
  • Apply the least destructive correction and rerun the smallest equivalent scenario.

1. Evidence-first diagnostic sequence

  1. Preserve scanner logs, report-task.txt, API/UI finding evidence, and the exact Git SHA.
  2. Confirm Community Build/Server edition, version, instance mode, scanner, Java/runtime, and analyzer/plugin versions.
  3. Confirm indexed files, source revision, effective parameters, quality profile, and active security rule.
  4. Confirm report upload and Compute Engine task success.
  5. Inspect the exact current finding representation: vulnerability/security issue, classic hotspot, migrated issue, or no finding.
  6. Inspect rule context, primary/secondary flow locations, status, assignment, comments, rating/gate, and permissions.
  7. Only then inspect network/auth/database/search/JVM/container state if analysis infrastructure is implicated.
  8. Apply the least destructive correction and rerun the smallest equivalent fixture.

2. Failure: “There is no hotspot, therefore the pattern is safe”

In 2026 this conclusion can be wrong for at least four independent reasons:

  • The rule was migrated from a hotspot into an ordinary security issue.
  • The relevant rule is inactive in the project profile.
  • The language/analyzer no longer uses that classification.
  • The file was not indexed or the fixture does not match the rule.

Preserve the rule search, profile, scanner indexing log, and Issues view. Search current issues and rule metadata before assuming the old Hotspots surface should contain anything.

3. Failure: “No security findings means secure”

A clean static-analysis result proves only that the configured analyzers raised no findings in the analyzed scope under the current rules and version. It does not prove absence of business-logic flaws, runtime configuration weaknesses, dependency compromise, authentication mistakes, authorization bypasses, unmodeled injection flows, infrastructure exposure, or vulnerabilities outside supported languages/features.

Production practice. Pair static analysis with tests, dependency/SCA controls, secret management, threat modeling, secure configuration, review, runtime monitoring, and where appropriate authorized dynamic/security testing. Chapter 16 expands some of these boundaries.

4. Failure: using a public vulnerable target to “test SonarQube”

SonarQube analyzes source; this chapter does not need network exploitation. A deliberately vulnerable public service introduces authorization, safety, rate, and legal problems while teaching the wrong layer. Keep the insecure behavior as inert local source and let the analyzer inspect it.

5. Failure: embedding a real secret so the scanner can find it

Never use a real credential as test data. Use unmistakably fake values such as not-a-real-secret, and keep even fake tokens out of Git history when the exercise is about credential handling. The scanner token itself belongs in an environment variable or CI secret store, not in sonar-project.properties or shell history.

6. Failure: teaching commercial taint analysis as universal

If Community Build does not report a source-to-sink injection flow, that is not proof that the flow is safe or that the scanner is broken. Verify the product matrix. Current Sonar product material places injection-vulnerability taint analysis in Developer edition and above for selected languages. Use a manual source→sink diagram as the free fallback.

7. Failure: changing policy to make security evidence disappear

Reactive rule deactivation, broad exclusions, gate threshold lowering, mass acceptance, or mass false-positive marking can all make dashboards greener without changing code risk. These are governance changes and must be treated as such, with owners, rationale, scope, approval, and rollback—not as troubleshooting shortcuts.

8. Intentionally broken example: preserve the apparent contradiction

Symptom: An older tutorial predicts a Security Hotspot for a cookie-related pattern. On Community Build 26.9 the Hotspots view/API shows none, but the project has a new security issue with the same/related rule family.

git rev-parse HEAD | tee evidence/broken/revision.txt
cp .scannerwork/report-task.txt evidence/broken/report-task.txt

# Preserve the current issue population:
curl -fsS -H "Authorization: Bearer $SONAR_TOKEN" \
  "$SONAR_HOST_URL/api/issues/search?componentKeys=$SONAR_PROJECT_KEY&ps=100" \
  > evidence/broken/issues.json

# Legacy endpoint may be deprecated/empty; preserve rather than treating emptiness as proof:
curl -fsS -H "Authorization: Bearer $SONAR_TOKEN" \
  "$SONAR_HOST_URL/api/hotspots/search?projectKey=$SONAR_PROJECT_KEY&ps=100" \
  > evidence/broken/hotspots.json || true

Diagnosis: Confirm server version, inspect the rule key and tags/history, and compare with the 2026 hotspot-migration notice. If the finding migrated, the correction is not to re-enable an old UI; it is to update the runbook to the current issue workflow while preserving contextual-review rationale.

9. Causal failure map

Evidence Likely layer Least-destructive next step
File not indexed Scanner scope/base directory Inspect effective parameters and indexing log.
Rule absent/inactive Quality profile/analyzer Inspect rule/profile/version; do not activate blindly in production.
Scanner upload succeeds, CE fails Server processing Preserve CE task/error and server logs.
No taint flow on Community Build Edition/language capability Verify matrix; use manual/free fallback.
Hotspots endpoint empty after upgrade Product migration/API Search security issues and migration metadata; update automation.
Finding vanished after profile edit Policy, not source Restore/compare policy before claiming remediation.

10. Production anti-patterns to reject

  • Do not delete projects to erase security history.
  • Do not directly edit SonarQube database/search state.
  • Do not disable TLS verification to “fix” scanner authentication.
  • Do not use administrator tokens in routine analysis.
  • Do not mass-suppress or mark findings false positive to make a gate green.
  • Do not clear logs/caches before preserving first-failure evidence.
  • Do not downgrade to an unsupported server/analyzer version as a shortcut.
  • Do not replace a failing project key with a new one to reset history.

Knowledge check

An old hotspot API returns an empty list after a 2026 upgrade. What is the first interpretation?

Why preserve a failed Compute Engine task before retrying?

What is wrong with using a real API key to test secret detection?

If a finding disappears after a quality-profile change, can you claim the code was fixed?

Community Build shows no taint flow for a manually obvious source→sink path. What next?

Next lesson

Produce the auditable security-review checkpoint

Lesson 5 packages the revision, task, finding, review, edition, and residual-risk evidence.

Official references and version notes

Version and compatibility note

Rechecked 2026-09-08. Mandatory examples target SonarQube Community Build 26.9.0.129388 and SonarScanner CLI 8.1.0.6389. Sonar is actively migrating Security Hotspots into ordinary security issues/vulnerabilities during 2026; classic Hotspot UI/API objects may therefore differ by rule and release, and api/hotspots is deprecated from the 2026.4 server line. The course preserves the durable contextual-review concept while requiring learners to inspect the current object representation. Current product material advertises injection-vulnerability taint analysis in Developer edition and above for selected languages (Java, C#, JavaScript/TypeScript, Python, PHP, Kotlin, Go, VB.NET); the mandatory Community Build lab uses a manual source-to-sink fallback and does not emulate commercial analyzers. Recheck rule classification, migration state, instance mode, analyzer version, and edition/language support before applying automation to another release.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.