• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 25497482423

07 May 2026 01:03PM UTC coverage: 64.801% (+0.01%) from 64.789%
25497482423

push

github

web-flow
Cap webhook middleware request body at 1 MB (#5192)

The validating and mutating webhook middlewares both called io.ReadAll
on the inbound HTTP request body with no size cap before forwarding to
the configured webhook server. The client side correctly limited the
response body via io.LimitReader to MaxResponseSize, but the server
side missed the symmetric limit on inbound requests, so the webhook
package would buffer arbitrarily large bodies into memory.

Wrap r.Body with http.MaxBytesReader at MaxRequestSize (1 MB, symmetric
to MaxResponseSize) and return HTTP 413 with a JSON-RPC error envelope
when the limit is exceeded. Reject the read before any forwarding.

Note: this is the webhook-layer cap. mcp.ParsingMiddleware sits earlier
in the proxy chain and currently reads the body unbounded; capping
inbound bodies at the MCP parsing layer is tracked separately and is
the load-bearing fix against upstream DoS. This change still bounds
the webhook package's own re-read buffer and lays the symmetry
groundwork.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

12 of 12 new or added lines in 2 files covered. (100.0%)

5 existing lines in 2 files now uncovered.

63192 of 97517 relevant lines covered (64.8%)

59.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.38
/pkg/transport/proxy/httpsse/http_proxy.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc