SonarQube integration
Integration type: scanning tool. SonarQube and SonarCloud analyze code themselves and own the issues they raise, so verdicts go through SonarQube's own issue workflow. Compare the DefectDojo findings-management integration and the integration types.
Decide whether an issue or hotspot needs action, then record the evidence where your team works. Threatlint triages SonarQube/SonarCloud findings. Reviewing changes no server status; posting requires separate confirmation.
What you need
| Requirement | Action |
|---|---|
| HTTPS base URL | SonarQube origin/context path (https://example.test/sonarqube) or https://sonarcloud.io |
| User token | My Account → Security |
| Read permissions | Browse on the project |
| Posting permissions | Administer Issues / Administer Security Hotspots, as applicable |
| Source and model | SCM link or DevOps binding; GitHub/Azure DevOps access; configured model |
| Direct CLI triage | Semgrep CLI on PATH (semgrep --version); run fp-review checks that it is installed. This does not establish which engine produced the Sonar finding |
CLI
Replace the sample URL/key with an authorized issue:
-
Validate/save credentials:
threatlint sonar login --url https://sonarqube.example.test -
Fetch one issue and check out its source:
threatlint sonar fetch AYxExampleKey01 -o sonar.mdthreatlint sonar checkout SONAR-AYxExampleKey01 --dir ./sonar-review -
Run triage from the checkout (LM Studio by default; change
--provideras needed):(cd sonar-review && threatlint run fp-review --findings ../sonar.md --provider lmstudio) -
Inspect the report before posting.
Result: an artifact and advisory report, no server updates. Without source mapping, supply
--repo-url URL / --branch NAME, or disclose an evidence-only review.
References are SONAR-<issue-key> and SONAR-HOTSPOT-<hotspot-key>. A bare key is tried as an
issue, then a hotspot. Preserve that full reference in the report's Original finding field.
Explicit lists have no limit.
threatlint sonar fetch --project web --branch develop --severity CRITICAL -o sonar.md
Search filters: required --project; --branch or --pull-request;
--organization for SonarCloud; repeatable --type, --severity, --status; --limit
(default: every matching finding, within a 10,000-result window for each issue or hotspot search). Types default to VULNERABILITY and SECURITY_HOTSPOT.
Issues default to OPEN,CONFIRMED,REOPENED; hotspots to TO_REVIEW.
File/line: components[].path (else suffix after project:), line / textRange.
Repository: SCM link → DevOps binding; THREATLINT_SONAR_REPO_URL overrides.
Verify reviewed branch/revision matches the scan.
Credentials
CLI: THREATLINT_SONAR_URL / THREATLINT_SONAR_TOKEN → saved
~/.threatlint/sonarqube.json → Parameter Store token → unsaved interactive prompt.
THREATLINT_HOME relocates the saved file. Login calls GET /api/authentication/validate
before saving with POSIX mode 0600; protect Windows ACLs too.
Parameter Store: THREATLINT_SONAR_TOKEN_PARAMETER or sonarTokenParameter in ~/.threatlint/org.json,
using your AWS session (--aws-profile). Workbench shares the file; direct connections prefer
saved values over environment. Tokens use HTTP Basic with an empty password; redirects are refused.
Resolve
SonarQube stores no attachments. Publish the report for authorized reviewers and supply its URL:
threatlint sonar resolve SONAR-AYxExampleKey01 --report fp_review.md \
--report-url https://reports.example.test/reviews/123
The CLI asks first; --yes authorizes writes without prompting. Without --report-url, comments
name a local file, not a shared report. --docx names a file but does not upload it.
| Verdict | Issue | Security hotspot |
|---|---|---|
| FALSE POSITIVE | Add summary comment, then falsepositive transition | Mark REVIEWED / SAFE with comment |
| Evidence-backed TRUE POSITIVE | Add comment, attempt confirm | Comment only |
| Conservative TRUE POSITIVE | Comment only; do not claim independent confirmation | Comment only |
Current reviews use TRUE POSITIVE or FALSE POSITIVE. Legacy AMBIGUOUS
reports become conservative, unverified true positives while retaining their confidence and evidence gaps.
Comments include ID, confidence, title, outcome, and report location. Unavailable Confirm (HTTP 400) leaves the comment; other failures are reported. Writes are nontransactional: inspect server state before retrying.
For a status-neutral note, use
threatlint sonar note SONAR-AYxExampleKey01 --message "Awaiting matching scan revision."
(confirmation required).
Workbench
- Save URL/token in Settings → Scanning & triage → SonarQube.
- Open Finding triage, select SonarQube as the finding source, and enter keys or project/branch filters. Run and inspect each report in Findings.
- Select Post to SonarQube…, supply an optional HTTPS report location, and confirm.
Triage a scan report also accepts /api/issues/search and /api/hotspots/search JSON exports;
posting maps each imported result back to its issue/hotspot.
Direct Workbench reviews use one model run per finding, with up to 64 model runs per batch.
Narrow a filter or split a longer list before reviewing. Reviews run concurrently, normally 3 at a time.
In Advanced experience, Parallel review and budget lets you choose 1–8 parallel reviewers
and a lower model-run budget. Reports remain in Findings after temporary checkouts are removed.
Company administrators configure the connection; administrators and analysts can review and post.
The desktop app uses its local profile without a Threatlint login.
See Workbench import limits.
API calls
Reads: /api/issues/search, /api/hotspots/search, /api/hotspots/show,
/api/project_links/search, /api/alm_settings/get_binding, /api/authentication/validate.
Writes: /api/issues/add_comment, /api/issues/do_transition,
/api/hotspots/change_status, /api/hotspots/add_comment.
Limits
Available transitions depend on the server version and current issue state; newer servers may omit Confirm. Check the reported transition result after posting. A successful comment does not establish that the issue status changed.
Troubleshooting
| Symptom | Next action |
|---|---|
| 401 / 403 | Check token, Browse access, and permission for the specific write |
| Empty project search | Check branch/PR, organization, type, and default status filters |
| No repository | Add an SCM link/binding, use THREATLINT_SONAR_REPO_URL, or pass --repo-url |
| Comment posted, no Confirm | Check the reported transition result and server version; do not infer closure |
| Full report inaccessible | Publish it securely and use --report-url; local filenames are not uploads |
Next: check evidence, proposed fixes, and acceptance criteria before changing status.