/security-sonarqube:sonarqube-api-interactionfrom security-sonarqube
Use when interacting with the SonarQube Web API — search issues, check quality gates, fetch rule details, and transition findings
Ships in security-sonarqube. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The SonarQube Web API enables programmatic access to projects, issues, quality gates, and rules. All requests require Bearer token authentication.
All requests must include the Authorization header:
-H "Authorization: Bearer $SONARQUBE_TOKEN"
Error responses for authentication failures:
Endpoint: GET /api/issues/search
Query Parameters:
componentKeys — Comma-separated project keys (required)statuses — OPEN, CONFIRMED, RESOLVED, WONTFIX, FALSE_POSITIVE (default: OPEN)types — VULNERABILITY, SECURITY_HOTSPOT, BUG, CODE_SMELLseverities — BLOCKER, CRITICAL, MAJOR, MINOR, INFOps — Page size, default 100, max 500p — Page number (1-indexed)Example Request:
curl -H "Authorization: Bearer $SONARQUBE_TOKEN" \
"https://sonar.example.com/api/issues/search?componentKeys=my-project&statuses=OPEN,CONFIRMED&types=VULNERABILITY,SECURITY_HOTSPOT&severities=BLOCKER,CRITICAL,MAJOR&ps=100&p=1"
Response:
{
"total": 42,
"p": 1,
"ps": 100,
"issues": [
{
"key": "AVz7jNJ6ow7sdfP",
"component": "my-project:src/main/java/App.java",
"line": 42,
"rule": "java:S2077",
"severity": "BLOCKER",
"type": "VULNERABILITY",
"status": "OPEN",
"message": "SQL injection vulnerability detected",
"debt": "30min"
}
],
"paging": {
"pageIndex": 1,
"pageSize": 100,
"total": 42
}
}
Pagination: Use p parameter to iterate through pages if total > ps.
Endpoint: GET /api/qualitygates/project_status
Query Parameters:
projectKey — Project key (required)Example Request:
curl -H "Authorization: Bearer $SONARQUBE_TOKEN" \
"https://sonar.example.com/api/qualitygates/project_status?projectKey=my-project"
Response:
{
"projectStatus": {
"status": "ERROR",
"caycStatus": "yellow",
"qualityGateDetails": {
"name": "Default Quality Gate",
"conditions": [
{
"status": "ERROR",
"metricKey": "security_rating",
"operator": "GREATER_THAN",
"errorThreshold": "1",
"actualValue": "3",
"conditionName": "Security Rating"
},
{
"status": "OK",
"metricKey": "coverage",
"operator": "LESS_THAN",
"errorThreshold": "80",
"actualValue": "85"
}
]
}
}
}
Status Values:
OK — Quality gate passedERROR — One or more conditions failedNONE — No quality gate assigned to projectEndpoint: GET /api/rules/show
Query Parameters:
key — Rule key, e.g., "java:S2077" (required)Example Request:
curl -H "Authorization: Bearer $SONARQUBE_TOKEN" \
"https://sonar.example.com/api/rules/show?key=java:S2077"
Response:
{
"rule": {
"key": "java:S2077",
"repo": "java",
"name": "SQL injection vulnerability",
"severity": "BLOCKER",
"type": "VULNERABILITY",
"status": "READY",
"htmlDesc": "<p>SQL injection is a code injection technique...</p><h2>Noncompliant Code:</h2><pre>...</pre><h2>Compliant Code:</h2><pre>...</pre>",
"tags": ["cwe", "security", "owasp-top10"],
"system": false,
"langName": "Java",
"lang": "java",
"mdDesc": "..."
}
}
Fields:
htmlDesc — HTML description with remediation guidance and code examplestags — Array including CWE references (e.g., "cwe/cwe-89")severity — BLOCKER, CRITICAL, MAJOR, MINOR, INFOtype — VULNERABILITY, SECURITY_HOTSPOT, BUG, CODE_SMELLEndpoint: POST /api/issues/do_transition
Parameters (form-encoded):
issue — Issue key, e.g., "AVz7jNJ6ow7sdfP" (required)transition — confirm, resolve, falsepositive, wontfix (required)Example Request:
curl -X POST -H "Authorization: Bearer $SONARQUBE_TOKEN" \
"https://sonar.example.com/api/issues/do_transition" \
-d "issue=AVz7jNJ6ow7sdfP&transition=resolve"
Transition Meanings:
confirm — Confirms the issue is a real vulnerability (from OPEN)resolve — Marks as fixed/resolved (from OPEN or CONFIRMED)falsepositive — Marks as not a real issue (from OPEN or CONFIRMED)wontfix — Accepted risk, won't be fixed (from OPEN or CONFIRMED)Response:
{
"issue": {
"key": "AVz7jNJ6ow7sdfP",
"status": "RESOLVED"
}
}
Endpoint: GET /api/projects/search
Query Parameters:
q — Search query (optional)p — Page number (default: 1)ps — Page size (default: 100)Example Request:
curl -H "Authorization: Bearer $SONARQUBE_TOKEN" \
"https://sonar.example.com/api/projects/search?q=my"
Response:
{
"paging": {
"pageIndex": 1,
"pageSize": 100,
"total": 2
},
"projects": [
{
"key": "my-project",
"name": "My Project",
"qualifier": "TRK",
"visibility": "public",
"lastAnalysisDate": "2024-01-15T10:30:00+0000"
}
]
}
| HTTP Status | Error | Resolution |
|---|---|---|
| 200 | Success | Proceed normally |
| 400 | Bad Request | Check query parameters |
| 401 | Unauthorized | Verify $SONARQUBE_TOKEN is valid and not expired |
| 403 | Forbidden | User/token lacks required permissions |
| 404 | Not Found | Project key, issue, or rule doesn't exist |
| 429 | Too Many Requests | Rate limited; implement exponential backoff |
| 500 | Internal Server Error | SonarQube server error; retry after delay |
Search for OPEN vulnerabilities:
curl ... /api/issues/search?componentKeys=my-project&types=VULNERABILITY&statuses=OPEN
For each issue, fetch rule details:
curl ... /api/rules/show?key=<ruleKey>
Apply fix using remediation skill, then transition:
curl -X POST ... /api/issues/do_transition?issue=<issueKey>&transition=resolve
Check gate status:
curl ... /api/qualitygates/project_status?projectKey=my-project
If ERROR, identify failing condition and remediate
Re-check until status is OK
For multiple issues, paginate through results:
for p in 1 2 3; do
curl ... "/api/issues/search?componentKeys=my-project&p=$p&ps=100"
done
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/sonarqube-quality-gateUse when analyzing SonarQube quality gate results — interpret gate conditions, identify security-relevant failures, and remediate blockers/sonarqube-remediationUse when fixing SonarQube SAST alerts — maps SonarQube rule IDs and CWE categories to specific code fix patterns for injection, XSS, weak crypto, and hardcoded credentialsnpx claudepluginhub gagandeepp/software-agent-teams --plugin security-sonarqube