Limit webhook request body size to 1MB to prevent DoS (closes #1) #6
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#6
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch ":fix/issue-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review: PR#6 — Limit webhook request body size to 1MB
Overall: Looks good. Clean, minimal change that addresses the DoS vector.
Positives
io.LimitReader— idiomatic Go approach, no extra dependencies.Observations / Minor Concerns
413 Request Entity Too Largewould give webhook senders better feedback. Not a blocker — the current behavior is safe.200 OKbecause the truncated body fails JSON parse but is handled gracefully. This is a valid integration test, but a comment noting this intentional behavior would help future readers (already partially there).Content-Lengthcheck: A preliminaryContent-Lengthheader check could reject oversized requests before reading any bytes, saving I/O. Minor optimization, not required.Verdict: Approve-worthy. The fix is correct and sufficient for the stated issue.