Skip to content

fix(net): limit decompressed webhook response bodies - #2904

Open
pcbeingused33 wants to merge 1 commit into
frain-dev:mainfrom
pcbeingused33:fix/c3792-response-limit
Open

pcbeingused33 wants to merge 1 commit into
frain-dev:mainfrom
pcbeingused33:fix/c3792-response-limit

Conversation

@pcbeingused33

Copy link
Copy Markdown

Limit decoded webhook response bodies to max_response_size.

The dispatcher limits the response stream before creating the gzip reader, then reads the decoded stream without a limit. A highly compressible response can therefore exceed the configured cap in memory and in the response data stored for each delivery attempt.

Apply the same limit when reading the decoded body. This preserves the existing wire-size bound and truncation behavior while also bounding the retained decompressed response.

Testing

Added a regression test using a local HTTP server and the real dispatcher path, with explicit gzip negotiation. It checks identity and gzip responses both below and above a 50 KiB limit. On main, the gzip response expands to 1 MiB and fails the size assertion; with this fix, all four cases pass.

  • go test ./net -run '^TestDispatcherDoLimitsDecodedResponseBody$' -count=1
  • go test ./net -count=1

Compatibility: oversized decoded gzip bodies are now truncated to the configured limit, consistently with identity responses.

AI assistance: this change and regression tests were prepared using Codex.

@CLAassistant

CLAassistant commented Nov 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

2 participants