Skip to content

Cap the size of a response roxy will proxy - #81

Merged
p3k merged 1 commit into
mainfrom
cap-roxy-response-size
Sep 28, 2026
Merged

p3k merged 1 commit into
mainfrom
cap-roxy-response-size

Conversation

@p3k

@p3k p3k commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • roxy is a public, unauthenticated proxy – nothing stops a request for an arbitrarily large file, spending both the target's bandwidth and this server's. Capped at 10 MB, well past any real feed.
  • Applied in two places: the raw bytes read off the wire, and separately the decompressed size for a gzip response – a small compressed payload can still expand into a much larger one (a "zip bomb"), so capping only the wire size wouldn't actually bound memory use for a gzip response.

Test plan

  • A real oversized payload is rejected (502, Response too large to proxy)
  • Content exactly at the cap still passes
  • A 50 KB gzip payload that expands to 50 MB is caught by the decompression cap specifically, not just the wire-size one
  • Normal small responses, gzip and otherwise, still decompress correctly
  • Existing test.sh suite still passes unchanged

🤖 Generated with Claude Code

roxy is a public, unauthenticated proxy – nothing stops a request for
an arbitrarily large file, spending both the target’s bandwidth and
this server’s. Capped at 10 MB, well past any real feed.

Applied in two places: the raw bytes read off the wire, and
separately the decompressed size for a gzip response – a small
compressed payload can still expand into a much larger one (a “zip
bomb”), so capping only the wire size wouldn’t actually bound memory
use for a gzip response.

Verified directly: a real oversized payload is rejected, content
exactly at the cap still passes, a 50 KB gzip payload that expands to
50 MB is caught by the decompression cap specifically (not just the
wire-size one), and normal small responses – gzip and otherwise –
still decompress correctly. Existing test.sh suite still passes
unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@p3k
p3k merged commit ab0909d into main Sep 28, 2026
6 checks passed
@p3k
p3k deleted the cap-roxy-response-size branch September 28, 2026 08:14
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