Bug: Webhook endpoint reads request body without size limit (DoS vector) #1
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Description
In
internal/handlers/webhook.go,HandleWebhook()usesio.ReadAll(request.Body)with no size limit. An attacker who knows (or guesses) a webhook secret can send an arbitrarily large payload to exhaust server memory.Impact
Denial of service - a single HTTP request with a multi-gigabyte body will consume all available memory.
Location
internal/handlers/webhook.go:31-body, readErr := io.ReadAll(request.Body)Fix
Use
io.LimitReaderto cap the request body at a reasonable size (e.g., 1MB).