feat(parses): accept gzip-compressed upload bodies - #195
Merged
Conversation
… gzip) Pure-ASGI GzipRequestMiddleware inflates gzip request bodies before FastAPI parsing and the ingest HMAC check read them - the signing contract stays "HMAC over the uncompressed JSON" for both formats, and requests without the header pass through untouched, so pre-gzip plugin versions keep working unchanged. Guards: 16 MiB decompressed cap (413, zip-bomb), invalid gzip -> 400. Why: ACT JSON compresses 10-20x. A raider on a ~120 kbit/s effective route (2026-07-28 incident) could not push a 282 KB payload inside the plugin's HttpClient timeout; gzipped it's ~25 KB / ~2 s. Plugin v0.1.16 ships the compression side. Co-Authored-By: Claude Fable 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.
Summary
Server half of the gzip-upload pair (plugin v0.1.16 ships the other half; this deploys FIRST for backwards compat).
GzipRequestMiddleware(pure ASGI): requests withContent-Encoding: gzipare inflated before FastAPI parsing / the ingest HMAC check read the body. Signature contract unchanged — HMAC over the uncompressed JSON either way.Why: 2026-07-28 incident — 282 KB ACT payload on a ~120 kbit/s throttled route couldn't complete inside the plugin's 20 s HttpClient timeout. Gzipped that's ~25 KB.
Test plan
6 new tests: gzipped upload validates HMAC + inserts, tampered gzip body 401s, garbage gzip 400s, zip bomb 413s, plain requests pass through untouched, cap sanity. Full suite 1646 green, ruff + pyright clean.
🤖 Generated with Claude Code