Skip to content

Webhook rate limiting is skipped for event types without an installation field #391

Description

@jakharmonika364

What happened?

src/app/api/webhooks/github/route.ts only applies rate limiting when the incoming payload has an installation field:

const installationId = payload.installation?.id;
...
if (installationId) {
  // rate limit applied here
}

Several legitimate GitHub webhook event types don't carry an installation object at all (for example meta, security_advisory, github_app_authorization). Signature verification still runs first and is solid, so this isn't an auth bypass, but any event type that lacks installation skips the rate limiter entirely after that check passes, with no ceiling on how often it can be processed.

Steps to Reproduce

  1. Send a validly signed webhook payload for an event type with no installation field
  2. Repeat it as many times as you want
  3. None of them get rate limited, unlike events that do carry an installation id

Expected Behavior

Rate limiting should apply to every webhook event regardless of payload shape, maybe keyed by something else (delivery id, source IP, event type) when there's no installation id to key on.

Where does this occur?

API (GitHub webhooks)

Additional Context

Low likelihood of abuse since it still requires a valid signature, but it's an inconsistency worth closing, especially since a leaked or rotated webhook secret would otherwise have no rate ceiling on this path.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions