fix(api): cap the GitHub webhook request body size#353
Conversation
The webhook receiver read the entire request body with io.ReadAll and no size limit, before checking the signature, on a public unauthenticated route. A single large POST (or a few concurrent ones) could exhaust process memory. Wrap the body in http.MaxBytesReader at GitHub's 25 MiB payload cap and return 413 when it's exceeded. Closes Devlaner#329 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The GitHub webhook receiver read the whole request body with
io.ReadAlland no size limit, before checking the signature, on a public unauthenticated route. A single large POST, or a few concurrent ones, could exhaust process memory.Linked issues
Closes #329
Type of change
fix:)Surface
apps/api/)What changed
Wrap
c.Request.Bodyinhttp.MaxBytesReaderat GitHub's 25 MiB payload cap before reading, and return 413 when it's exceeded.Test plan
go build,go vet,go test ./...greenMaxBytesErrorand returns 413 instead of being buffered in fullAI assistance
Claude Code (Opus 4.8), commits carry aCo-Authored-By:trailer