Menu

1 / 2

Verifying Git Webhooks Across GitHub, GitLab, Gitea, and Forgejo Without Timing or Replay Bugs

DEV Community: typescript·hoagminh·3 days ago
#dmISD4Oj
#devtotypescript#devto#dev#signature#github
Long article (1166 words) — no AI summary yet.
Reading 0:00
15s threshold

Supporting "push to deploy" across multiple Git hosts sounds like a weekend feature: expose POST /api/webhooks/:id , check a signature header, parse the JSON body, and kick off a build.

Then the edge cases start piling up:

Gitea and Forgejo send X-GitHub-Event headers alongside their own headers—so checking GitHub first breaks signature verification for Gitea.

GitLab does not sign payloads with HMAC at all; it sends the raw shared secret in X-Gitlab-Token , where a naive === or length check leaks secret bytes and length via timing.

Returning 401 immediately when a webhook ID does not exist lets an attacker enumerate valid hook URLs by response latency.

Provider retries or captured payloads can trigger duplicate builds unless delivery IDs and timestamps are checked properly.

This is the design behind Git push webhook verification in Nitrobase ( services/git/webhooks.ts and features/git/webhook.server.ts ).

Nitrobase has only recently launched and is still in Beta .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.