fix(webhook): enforce chunked body limits - #3955
Closed
Gutslabs wants to merge 1 commit into
Closed
Conversation
This was referenced Apr 22, 2026
Collaborator
3 tasks
Collaborator
3 tasks
liuhao1024
pushed a commit
to liuhao1024/hermes-agent
that referenced
this pull request
Jul 5, 2026
The webhook adapter enforced max_body_bytes only via the Content-Length header; a Transfer-Encoding: chunked request (content_length=None) or a spoofed small Content-Length bypassed the cap entirely and read the full body (bounded only by aiohttp's implicit 1 MiB default, above any operator-configured smaller limit). - web.Application(client_max_size=max_body_bytes): aiohttp enforces the cap on every read path, chunked included - catch HTTPRequestEntityTooLarge -> 413 (was swallowed into generic 400) - post-read length re-check as defense in depth - chunked-upload regression test Manual port of PR NousResearch#3955 by @Gutslabs onto current main (handler had been restructured since); authorship preserved.
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
The webhook adapter enforced max_body_bytes only via the Content-Length header; a Transfer-Encoding: chunked request (content_length=None) or a spoofed small Content-Length bypassed the cap entirely and read the full body (bounded only by aiohttp's implicit 1 MiB default, above any operator-configured smaller limit). - web.Application(client_max_size=max_body_bytes): aiohttp enforces the cap on every read path, chunked included - catch HTTPRequestEntityTooLarge -> 413 (was swallowed into generic 400) - post-read length re-check as defense in depth - chunked-upload regression test Manual port of PR NousResearch#3955 by @Gutslabs onto current main (handler had been restructured since); authorship preserved.
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…webhook-chunked-limit fix(gateway): enforce body-size limits on chunked requests (salvage NousResearch#3955 + NousResearch#3949)
Contributor
|
Thanks for the security fix. This is already implemented on current
|
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
The webhook adapter enforced max_body_bytes only via the Content-Length header; a Transfer-Encoding: chunked request (content_length=None) or a spoofed small Content-Length bypassed the cap entirely and read the full body (bounded only by aiohttp's implicit 1 MiB default, above any operator-configured smaller limit). - web.Application(client_max_size=max_body_bytes): aiohttp enforces the cap on every read path, chunked included - catch HTTPRequestEntityTooLarge -> 413 (was swallowed into generic 400) - post-read length re-check as defense in depth - chunked-upload regression test Manual port of PR NousResearch#3955 by @Gutslabs onto current main (handler had been restructured since); authorship preserved.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…webhook-chunked-limit fix(gateway): enforce body-size limits on chunked requests (salvage NousResearch#3955 + NousResearch#3949)
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
The webhook adapter enforced max_body_bytes only via the Content-Length header; a Transfer-Encoding: chunked request (content_length=None) or a spoofed small Content-Length bypassed the cap entirely and read the full body (bounded only by aiohttp's implicit 1 MiB default, above any operator-configured smaller limit). - web.Application(client_max_size=max_body_bytes): aiohttp enforces the cap on every read path, chunked included - catch HTTPRequestEntityTooLarge -> 413 (was swallowed into generic 400) - post-read length re-check as defense in depth - chunked-upload regression test Manual port of PR NousResearch#3955 by @Gutslabs onto current main (handler had been restructured since); authorship preserved.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…webhook-chunked-limit fix(gateway): enforce body-size limits on chunked requests (salvage NousResearch#3955 + NousResearch#3949)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
The webhook adapter enforced max_body_bytes only via the Content-Length header; a Transfer-Encoding: chunked request (content_length=None) or a spoofed small Content-Length bypassed the cap entirely and read the full body (bounded only by aiohttp's implicit 1 MiB default, above any operator-configured smaller limit). - web.Application(client_max_size=max_body_bytes): aiohttp enforces the cap on every read path, chunked included - catch HTTPRequestEntityTooLarge -> 413 (was swallowed into generic 400) - post-read length re-check as defense in depth - chunked-upload regression test Manual port of PR NousResearch#3955 by @Gutslabs onto current main (handler had been restructured since); authorship preserved.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…webhook-chunked-limit fix(gateway): enforce body-size limits on chunked requests (salvage NousResearch#3955 + NousResearch#3949)
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.
What does this PR do?
Fixes webhook payload size enforcement for chunked requests.
Previously, the webhook adapter only rejected oversized payloads when
Content-Lengthwas present and over the configuredmax_body_bytes. Chunked requests omitContent-Length, so an oversized webhook body could still be fully read and accepted.This change enforces the same limit for chunked bodies by configuring aiohttp's
client_max_size, mappingHTTPRequestEntityTooLargeto a clean413response, and keeping a post-read size check as a defensive fallback.Type of Change
Changes Made
client_max_sizeon the webhook aiohttp app frommax_body_bytes413 Payload too largewhenrequest.read()exceeds the limitHow to Test
source .venv/bin/activatepython -m pytest tests/gateway/test_webhook_adapter.py -qmax_body_bytes413instead of accepting the webhookNotes
202 Accepted413 Payload too largemainstill has unrelated failures in Slack, delegate credential resolution, transcription, website policy, and CLI tools reset tests