Merge pull request #4194 from quarkcore/fix/gitlab-empty-webhook-secret

Fix: Gitlab webhooks can be triggered without secret
This commit is contained in:
Andras Bacsai 2024-11-12 10:22:36 +01:00 committed by GitHub
commit da9c8eed16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,7 @@ public function manual(Request $request)
return;
}
$return_payloads = collect([]);
$payload = $request->collect();
$headers = $request->headers->all();
@ -48,6 +49,16 @@ public function manual(Request $request)
return response($return_payloads);
}
if (empty($x_gitlab_token)) {
$return_payloads->push([
'status' => 'failed',
'message' => 'Invalid signature.',
]);
ray('Invalid signature');
return response($return_payloads);
}
if ($x_gitlab_event === 'push') {
$branch = data_get($payload, 'ref');
$full_name = data_get($payload, 'project.path_with_namespace');