Skip to content

fix: limit decompressed webhook payloads to 10 MiB - #108

Merged
mogita merged 1 commit into
masterfrom
fix/webhook-gunzip-limit
Nov 13, 2026
Merged

mogita merged 1 commit into
masterfrom
fix/webhook-gunzip-limit

Conversation

@mogita

@mogita mogita commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Ticket

APPSEC-326

Problem

The webhook gunzip helper inflated 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 and raises StreamChat::Webhook::InvalidWebhookError ("payload exceeds ... bytes"). Raise StreamChat::Webhook.max_payload_bytes if your events are larger. The same helper backs the SQS and SNS decode paths.

The webhook helper, its tests and the new _invalid/oversized_compression fixture are copied byte for byte from a regeneration at chat v241.7.0 (protocol openapi-v241.7.0). The rest of that regeneration is left for a later release.

ChatClient#fork_message_ids is added as an alias of fork_message_i_ds in extensions/chat_extensions.rb. A later regeneration renames the generated method to fork_message_ids; the extension then keeps fork_message_i_ds as a deprecated alias, so neither name breaks.

How to verify

  1. make test && bundle exec rubocop
  2. The oversized_compression test expects "payload exceeds".

BEGIN_COMMIT_OVERRIDE
fix: limit decompressed webhook payloads to 10 MiB, configurable with StreamChat::Webhook.max_payload_bytes

feat: add fork_message_ids, the name a later regeneration gives fork_message_i_ds
END_COMMIT_OVERRIDE

@mogita
mogita merged commit a5899e0 into master Nov 13, 2026
7 checks passed
@mogita
mogita deleted the fix/webhook-gunzip-limit branch November 13, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant