Skip to content

Commit aaffb89

Browse files
committed
[gitlab/webhook] return code 200 on Unauthorized
Otherwise we provoke permanent deactivation of the webhook. In future we need to make the Unauthorized situation fixable from Gitpod.
1 parent 1bc8611 commit aaffb89

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/server/ee/src/prebuilds/gitlab-app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class GitLabApp {
6060
if (eventType !== "Push Hook" || !secretToken) {
6161
log.warn("Unhandled GitLab event.", { event: eventType, secretToken: !!secretToken });
6262
res.status(200).send("Unhandled event.");
63-
await this.webhookEvents.updateEvent(event.id, { status: "dismissed_unauthorized" });
63+
await this.webhookEvents.updateEvent(event.id, { status: "ignored" });
6464
return;
6565
}
6666

@@ -75,11 +75,11 @@ export class GitLabApp {
7575
TraceContext.setError({ span }, error);
7676
}
7777
if (!user) {
78-
// If the webhook installer is no longer found in Gitpod's DB
79-
// we should send a UNAUTHORIZED signal.
78+
// Gitpod is not supposed to return 4xx codes on issues with project permissions.
8079
span.finish();
81-
res.status(401).send("Unauthorized.");
80+
res.status(200).send("Unauthorized.");
8281
await this.webhookEvents.updateEvent(event.id, { status: "dismissed_unauthorized" });
82+
// TODO(at) explore ways to mark a project having issues with permissions.
8383
return;
8484
}
8585
/** no await */ this.handlePushHook({ span }, context, user, event).catch((error) => {

0 commit comments

Comments
 (0)