# No change required for patch versions
versionEOL=2025-03-01
-pluginApiVersion=10.7.0.2191
+pluginApiVersion=10.8.0.2326
description=Open source platform for continuous inspection of code quality
projectTitle=SonarQube
org.gradle.jvmargs=-Xmx2048m
import org.sonarqube.ws.client.OkHttpClientBuilder;
import static java.util.stream.Collectors.joining;
-import static org.sonar.api.internal.apachecommons.lang.StringUtils.isBlank;
-import static org.sonar.api.internal.apachecommons.lang.StringUtils.substringBeforeLast;
+import static org.apache.commons.lang3.StringUtils.isBlank;
+import static org.apache.commons.lang3.StringUtils.substringBeforeLast;
@ServerSide
public class AzureDevOpsHttpClient {
import org.slf4j.LoggerFactory;
import org.sonar.server.exceptions.NotFoundException;
-import static org.sonar.api.internal.apachecommons.lang.StringUtils.removeEnd;
+import static org.apache.commons.lang3.StringUtils.removeEnd;
@ServerSide
public class BitbucketCloudRestClient {
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static java.util.Locale.ENGLISH;
-import static org.sonar.api.internal.apachecommons.lang.StringUtils.removeEnd;
+import static org.apache.commons.lang3.StringUtils.removeEnd;
@ServerSide
public class BitbucketServerRestClient {
import org.sonar.alm.client.github.security.AppToken;
import org.sonar.alm.client.github.security.GithubAppSecurity;
import org.sonar.alm.client.gitlab.GsonApp;
-import org.sonar.api.internal.apachecommons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.sonar.auth.github.AppInstallationToken;
import org.sonar.auth.github.GitHubSettings;
import org.sonar.auth.github.GithubAppConfiguration;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
-import org.sonar.api.internal.apachecommons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.sonar.api.platform.Server;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
URI redirectionEndpointUrl = URI.create(server.getContextPath() + "/")
.resolve(SAML_VALIDATION_CONTROLLER_CONTEXT + "/")
.resolve(SAML_VALIDATION_KEY);
- String samlResponse = StringEscapeUtils.escapeHtml(request.getParameter(SAML_RESPONSE_PARAMETER));
+ String samlResponse = StringEscapeUtils.escapeHtml3(request.getParameter(SAML_RESPONSE_PARAMETER));
String csrfToken = getCsrfTokenFromRelayState(relayState);
String nonce = SamlValidationCspHeaders.addCspHeadersWithNonceToResponse(response);
private static String getCsrfTokenFromRelayState(@Nullable String relayState) {
if (relayState != null && relayState.contains("/")) {
- return StringEscapeUtils.escapeHtml(relayState.split("/")[1]);
+ return StringEscapeUtils.escapeHtml3(relayState.split("/")[1]);
}
return "";
}
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toMap;
-import static org.sonar.api.internal.apachecommons.lang.StringUtils.startsWithIgnoreCase;
+import static org.apache.commons.lang3.StringUtils.startsWithIgnoreCase;
import static org.sonar.api.measures.CoreMetrics.BUGS_KEY;
import static org.sonar.api.measures.CoreMetrics.DEVELOPMENT_COST_KEY;
import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.internal.apachecommons.io.IOUtils;
-import org.sonar.api.internal.apachecommons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.sonar.api.testfixtures.log.LogTester;
import org.sonar.server.es.EsClient;
import org.sonar.server.es.response.NodeStatsResponse;
.setInternal(true)
.setDescription("Endpoint for listening to server side events. Currently it notifies listener about change to activation of a rule")
.setSince("9.4")
+ .setContentType(Response.ContentType.NO_CONTENT)
.setHandler(this);
action
assertThat(def.params()).extracting(WebService.Param::key, WebService.Param::isRequired).containsOnly(
tuple("projectKey", false),
tuple("messageType", true));
+ assertThat(def.responseExampleAsString()).isNotEmpty();
}
@Test
private final SafeModeMonitoringMetricAction safeModeMonitoringMetricAction = new SafeModeMonitoringMetricAction(systemPasscode, bearerPasscode);
private final WsActionTester ws = new WsActionTester(safeModeMonitoringMetricAction);
+ @Test
+ public void define_containsResponseExample() {
+ assertThat(ws.getDef().responseExampleAsString()).isNotEmpty();
+ }
+
@Test
public void no_authentication_throw_insufficient_privileges_error() {
TestRequest request = ws.newRequest();
.setInternal(true)
.setSince("8.2")
.setHandler(this)
+ .setContentType(Response.ContentType.NO_CONTENT)
.setChangelog(new Change("9.0", "Bitbucket Cloud support was added"));
action.createParam(PARAM_ALM_SETTING)
WebService.NewAction action = context.createAction("check")
.setDescription("Check if a message has been dismissed.")
.setSince("10.2")
+ .setResponseExample(getClass().getResource("check-example.json"))
.setInternal(true)
.setHandler(this);
*/
package org.sonar.server.monitoring;
-import org.sonar.api.server.ws.WebService;
import org.sonar.server.platform.ws.SafeModeMonitoringMetricAction;
import org.sonar.server.user.BearerPasscode;
import org.sonar.server.user.SystemPasscode;
this.userSession = userSession;
}
- @Override
- public void define(WebService.NewController context) {
- context.createAction("metrics")
- .setSince("9.3")
- .setDescription("""
- Return monitoring metrics in Prometheus format.\s
- Support content type 'text/plain' (default) and 'application/openmetrics-text'.
- this endpoint can be access using a Bearer token, that needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.""")
- .setResponseExample(getClass().getResource("monitoring-metrics.txt"))
- .setHandler(this);
-
- isWebUpGauge.set(1D);
- }
-
@Override
public boolean isSystemAdmin() {
return userSession.isSystemAdministrator();
"</p>")
.setSince("9.1")
.setInternal(true)
+ .setContentType(Response.ContentType.NO_CONTENT)
.setHandler(handler);
}
*/
package org.sonar.server.platform.ws;
+import com.google.common.io.Resources;
import com.google.common.net.HttpHeaders;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Gauge;
@Override
public void define(WebService.NewController context) {
- context.createAction("metrics").setHandler(this);
+ context.createAction("metrics")
+ .setSince("9.3")
+ .setDescription("""
+ Return monitoring metrics in Prometheus format.\s
+ Support content type 'text/plain' (default) and 'application/openmetrics-text'.
+ this endpoint can be access using a Bearer token, that needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.""")
+ .setResponseExample(Resources.getResource(this.getClass(), "monitoring-metrics.txt"))
+ .setHandler(this);
isWebUpGauge.set(1D);
}
.setSince("7.2")
.setDescription("Download plugin JAR, for usage by scanner engine")
.setInternal(true)
- .setResponseExample(getClass().getResource("example-download.json"))
+ .setContentType(Response.ContentType.BINARY)
.setHandler(this);
action.createParam(PLUGIN_PARAM)
import java.io.IOException;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
+import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.web.FilterChain;
import org.sonar.api.web.HttpFilter;
.setPost(false)
.setHandler(ServletFilterHandler.INSTANCE)
.setDescription("Initiate a SAML request to the identity Provider for configuration validation purpose.")
+ .setContentType(Response.ContentType.NO_CONTENT)
.setSince("9.7");
}
+ "Data is returned gzipped if the corresponding 'Accept-Encoding' header is set in the request.")
.setChangelog(new Change("9.9", "The web service is no longer internal"))
.setSince("9.4")
+ .setContentType(Response.ContentType.BINARY)
.setHandler(this);
action.createParam(PROJECT)
--- /dev/null
+{
+ "dismissed":true
+}
\ No newline at end of file
--- /dev/null
+# HELP sonarqube_compute_engine_tasks_running_duration_seconds Compute engine task running time in seconds
+# TYPE sonarqube_compute_engine_tasks_running_duration_seconds summary
+# HELP sonarqube_health_web_status Tells whether Web process is up or down. 1 for up, 0 for down
+# TYPE sonarqube_health_web_status gauge
+sonarqube_health_web_status 1.0
+# HELP sonarqube_license_days_before_expiration_total Days until the SonarQube license will expire.
+# TYPE sonarqube_license_days_before_expiration_total gauge
+sonarqube_license_days_before_expiration_total 28.0
+# HELP sonarqube_license_number_of_lines_remaining_total Number of lines remaining until the limit for the current license is hit.
+# TYPE sonarqube_license_number_of_lines_remaining_total gauge
+sonarqube_license_number_of_lines_remaining_total 5000000.0
+# HELP sonarqube_health_compute_engine_status Tells whether Compute Engine is up (healthy, ready to take tasks) or down. 1 for up, 0 for down
+# TYPE sonarqube_health_compute_engine_status gauge
+sonarqube_health_compute_engine_status 1.0
+# HELP sonarqube_license_number_of_lines_analyzed_total Number of lines analyzed.
+# TYPE sonarqube_license_number_of_lines_analyzed_total gauge
+sonarqube_license_number_of_lines_analyzed_total 0.0
+# HELP sonarqube_web_uptime_minutes Number of minutes for how long the SonarQube instance is running
+# TYPE sonarqube_web_uptime_minutes gauge
+sonarqube_web_uptime_minutes 13.0
+# HELP sonarqube_health_integration_azuredevops_status Tells whether SonarQube instance has configured Azure integration and its status is green. 1 for green, 0 otherwise .
+# TYPE sonarqube_health_integration_azuredevops_status gauge
+sonarqube_health_integration_azuredevops_status 0.0
+# HELP sonarqube_health_elasticsearch_status Tells whether Elasticsearch is up or down. 1 for Up, 0 for down
+# TYPE sonarqube_health_elasticsearch_status gauge
+sonarqube_health_elasticsearch_status 1.0
+# HELP sonarqube_health_integration_gitlab_status Tells whether SonarQube instance has configured GitLab integration and its status is green. 1 for green, 0 otherwise .
+# TYPE sonarqube_health_integration_gitlab_status gauge
+sonarqube_health_integration_gitlab_status 0.0
+# HELP sonarqube_health_integration_github_status Tells whether SonarQube instance has configured GitHub integration and its status is green. 1 for green, 0 otherwise .
+# TYPE sonarqube_health_integration_github_status gauge
+sonarqube_health_integration_github_status 0.0
+# HELP sonarqube_health_integration_bitbucket_status Tells whether SonarQube instance has configured BitBucket integration and its status is green. 1 for green, 0 otherwise .
+# TYPE sonarqube_health_integration_bitbucket_status gauge
+sonarqube_health_integration_bitbucket_status 0.0
+# HELP sonarqube_elasticsearch_disk_space_total_bytes Total disk space on the device
+# TYPE sonarqube_elasticsearch_disk_space_total_bytes gauge
+sonarqube_elasticsearch_disk_space_total_bytes{node_name="sonarqube",} 9.9466258432E11
+# HELP sonarqube_elasticsearch_disk_space_free_bytes Space left on device
+# TYPE sonarqube_elasticsearch_disk_space_free_bytes gauge
+sonarqube_elasticsearch_disk_space_free_bytes{node_name="sonarqube",} 9.00287975424E11
+# HELP sonarqube_compute_engine_pending_tasks_total Number of tasks at given point of time that were pending in the Compute Engine queue [SHARED, same value for every SonarQube instance]
+# TYPE sonarqube_compute_engine_pending_tasks_total gauge
+sonarqube_compute_engine_pending_tasks_total 0.0
\ No newline at end of file