From security-sonarqube
Use when interacting with the SonarQube Web API — search issues, check quality gates, fetch rule details, and transition findings
How this skill is triggered — by the user, by Claude, or both
Slash command
/security-sonarqube:sonarqube-api-interactionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The SonarQube Web API enables programmatic access to projects, issues, quality gates, and rules. All requests require Bearer token authentication.
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
npx claudepluginhub gagandeepp/software-agent-teams --plugin security-sonarqubeGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.