Repository navigation
fix: limit decompressed webhook payloads to 10 MiB, configurable with webhookConfig.maxPayloadBytes - #394
Merged
Conversation
… webhookConfig.maxPayloadBytes
oliverlaz
approved these changes
Nov 13, 2026
mogita
pushed a commit
that referenced
this pull request
Nov 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.9.3](v0.9.2...v0.9.3) (2026-11-13) ### Bug Fixes * limit decompressed webhook payloads to 10 MiB, configurable with webhookConfig.maxPayloadBytes ([#394](#394)) ([3de82bd](3de82bd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.
Problem
gunzipPayloadinflated a gzip body with no size limit before the signature check, so an unsigned request of a few hundred KB could expand to hundreds of MB and exhaust memory on a webhook endpoint.Solution
Decompression now stops at 10 MiB via
zlib.gunzipSync'smaxOutputLengthand throwsInvalidWebhookError("gzip decompression failed: payload exceeds 10485760 bytes"). The same helper backsverifyAndParseWebhook,parseSqsandparseSns. Raise the cap if your events are larger:Uncompressed bodies are not limited. This matches the default and error message of the other server SDKs.
How to verify
yarn vitest run __tests__/integration/webhook-compression.test.ts(passes locally on Node 26 and withbun run vitest).size limittests inflate a body of exactly 10 MiB, reject 10 MiB + 1 byte throughverifyAndParseWebhookandparseSqs, and honour a custom limit.