Skip to content
Snippets Groups Projects
Commit b00ff94d authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

re #53

parent 95c08289
No related branches found
No related tags found
No related merge requests found
......@@ -8,11 +8,11 @@ final class HooksController extends EventController
public function system_action()
{
if (!$this->verifySecret(Config::get()->getValue('TRAC2GITLAB_GITLAB_SYSTEMHOOK_SECRET'))) {
throw new AccessDeniedException();
$this->halt('Thou shalt not pass.', 403);
}
if (!$this->verifyEvent()) {
throw new Exception('This is not a valid gitlab event');
$this->halt('This is not a valid gitlab event');
}
$this->processHooks($this->getKnownSystemhooks());
......@@ -29,7 +29,7 @@ final class HooksController extends EventController
public function web_action()
{
if (!$this->verifySecret(Config::get()->getValue('TRAC2GITLAB_GITLAB_WEBHOOK_SECRET'))) {
throw new AccessDeniedException();
$this->halt('Thou shalt not pass.', 403);
}
$payload = $this->payload();
......@@ -39,20 +39,7 @@ final class HooksController extends EventController
|| !isset($payload['project']['id'])
|| $payload['project']['id'] != $this->gitlab_project_id
) {
$this->set_status(500);
$this->render_json([
'payload' => $payload['project']['id'] ?? 'NONE!',
'id' => $this->gitlab_project_id,
'result' => $this->verifyEvent(),
'event' => $_SERVER['HTTP_X_GITLAB_EVENT'] ?? 'NONE',
'server' => $_SERVER,
'names' => [
'event' => $payload['event_name'],
'object_kind' => $payload['object_kind'],
],
]);
return;
throw new Exception('This is not a valid gitlab event');
$this->halt('This is not a valid gitlab event');
}
$this->processHooks($this->getKnownWebhooks());
......
......@@ -14,7 +14,7 @@ abstract class EventController extends GitlabController
parent::before_filter($action, $args);
if (!Request::isPost()) {
throw new MethodNotAllowedException();
$this->halt('Only POST requests are allowed');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment