aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Poscia <aurelien.poscia@sonarsource.com>2023-08-23 11:57:44 +0200
committersonartech <sonartech@sonarsource.com>2023-09-12 20:02:36 +0000
commitdbbae03edaec34168ecdea5508f07509f9f47cd8 (patch)
tree97d20b4955ad52514bc9a4dded53282b3befcccf
parenteea858839be4558a7fdc8f74b9b5f2345dec9b3b (diff)
downloadsonarqube-dbbae03edaec34168ecdea5508f07509f9f47cd8.tar.gz
sonarqube-dbbae03edaec34168ecdea5508f07509f9f47cd8.zip
SONAR-20452 SONAR-19977 add AppId to force auth via webhook
(cherry picked from commit 4cd901eaf87e26f6e9b803614e0f3b23282f8777)
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SendGithubCodeScanningAlertWebhookPayloadRequest.java12
2 files changed, 13 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java
index 6d532bb8cb1..0acb93b62d5 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java
@@ -210,6 +210,7 @@ public class AlmIntegrationsService extends BaseService {
.setHeader("X-GitHub-Event", request.getGithubEventHeader())
.setHeader("X-Hub-Signature", request.getGithubSignatureHeader())
.setHeader("X-Hub-Signature-256", request.getGithubSignature256Header())
+ .setHeader("x-github-hook-installation-target-id", request.getGithubAppId())
.setBody(request.getPayload())
.setMediaType(MediaTypes.JSON)
).content();
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SendGithubCodeScanningAlertWebhookPayloadRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SendGithubCodeScanningAlertWebhookPayloadRequest.java
index 770d1fd99a1..46863363a22 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SendGithubCodeScanningAlertWebhookPayloadRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SendGithubCodeScanningAlertWebhookPayloadRequest.java
@@ -24,6 +24,7 @@ import javax.annotation.Generated;
/**
* This is part of the internal API.
* This is a POST request.
+ *
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/webhook_github">Further information about this action online (including a response example)</a>
* @since 9.7
*/
@@ -34,6 +35,8 @@ public class SendGithubCodeScanningAlertWebhookPayloadRequest {
private String githubSignatureHeader;
private String githubSignature256Header;
+ private String githubAppId;
+
/**
* This is a mandatory parameter.
*/
@@ -81,4 +84,13 @@ public class SendGithubCodeScanningAlertWebhookPayloadRequest {
public String getGithubSignature256Header() {
return githubSignature256Header;
}
+
+ public String getGithubAppId() {
+ return githubAppId;
+ }
+
+ public SendGithubCodeScanningAlertWebhookPayloadRequest setGithubAppId(String githubAppId) {
+ this.githubAppId = githubAppId;
+ return this;
+ }
}