Skip to content

feat(parses): accept gzip-compressed upload bodies - #195

Merged
VortexUK merged 1 commit into
mainfrom
feat/gzip-ingest
Jul 28, 2026
Merged

feat(parses): accept gzip-compressed upload bodies#195
VortexUK merged 1 commit into
mainfrom
feat/gzip-ingest

Conversation

@VortexUK

Copy link
Copy Markdown
Owner

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 with Content-Encoding: gzip are inflated before FastAPI parsing / the ingest HMAC check read the body. Signature contract unchanged — HMAC over the uncompressed JSON either way.
  • No header → completely untouched: current plugin versions keep working.
  • Zip-bomb guard: 16 MiB decompressed cap → 413; invalid gzip → 400.

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

… 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>
@VortexUK
VortexUK merged commit 5c11388 into main Jul 28, 2026
6 checks passed
@VortexUK
VortexUK deleted the feat/gzip-ingest branch July 28, 2026 20:54
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