2.4 KiB
2.4 KiB
name, description
| name | description |
|---|---|
| secure-coding-plugin | Use when adding or reviewing configuration, web-service inputs, authorization, outbound HTTP, secrets, or dependencies in the plugin. |
Secure coding for this plugin
- Require authenticated SonarQube users and check
Create Projectson every action that enumerates or imports repositories. - Fail closed when the current-user permission response is absent or malformed. Verify local connector authorization behavior on the target instance before deployment.
- Treat all browser input as untrusted. Bound batch size and string lengths; validate organization and repository identifiers before API calls.
- Validate configured Gitea URL as absolute HTTP(S) with host and no userinfo, query, or fragment. The URL is trusted administrator configuration and may target a private Gitea host; never accept a request-specific outbound URL.
- Disable redirects to avoid forwarding the Gitea token; do not expose outbound arbitrary URL input.
- Store the token in a
.securedPASSWORD property. Never return it from web services, JS, logs, errors, or generated files. - Use same-origin authenticated SonarQube requests for mutations; do not build custom cookie bypasses. Preserve SonarQube's normal CSRF/session protections by sending
X-XSRF-TOKENfrom theXSRF-TOKENcookie on POST requests. - Reject duplicate or colliding project keys before making any project mutations.
- Pin dependencies, inspect transitive dependency changes, and keep the Sonar API provided.
Checklist
- Every endpoint checks Create Projects.
- URL, identifiers, and batch sizes validated.
- Secret handling and redirects safe.
- Project-key collisions fail closed.
- Dependency versions pinned.
Sources
- OWASP SSRF Prevention Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html (consulted 2026-10-28)
- SonarQube Community Build Web API security: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-28)
- SonarQube plugin configuration: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
Not verified
- Community Build 25.9.0.112764 returned HTTP 401 when the POST omitted
X-XSRF-TOKEN; the local browser flow passed after including it. The external Gitea endpoint and token policy remain administrator-controlled and were not evaluated.