Repository navigation
Accept webhooks up to GitHub's 25 MB - #531
Merged
Merged
Conversation
Every POST shared one 1 MB body limit, so a webhook for a big PR (a long body, many labels, a large push) got a 413 and its update was dropped until the hourly reconcile. Prod logged 47 of these on Oct 12-13 and 50 between Oct 16 and 20, about a dozen a day. The webhook route now parses up to GitHub's 25 MB limit; the board and the API keep 1 MB. The parsers move to lib/body-parsers.js so a test can mount them without starting the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: the route is public, and the secret was checked only after parsing, so anyone could make the server buffer 25 MB per request. The secret is in the query string, so it can be checked first; a request without it gets the same 401 before any of its body is read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖
Every POST shared one 1 MB body limit (
maxPostSizeinapp.js), so a webhook for a big PR got a 413 and its update was dropped until the hourly reconcile caught it. Prod's logs:PayloadTooLargeErrorThat's about a dozen dropped updates a day. GitHub sends webhook payloads up to 25 MB.
/hooksnow parses JSON and form bodies up to 25 MB. The board and the API keep 1 MB.lib/body-parsers.js, so a test can mount them without starting the app. The hook parsers run first; body-parser skips a body that's already parsed, so the global ones leave hook requests alone.test/body-parsers.test.jsposts a 2 MB body: JSON and form-encoded to/hooks/mainget a 200, JSON to another route still gets a 413, and a hook without the secret gets a 401.🤖 Generated with Claude Code