Skip to content

Commit

Permalink
fix: Webhook verifier unbounded IO read (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeymike committed Dec 19, 2024
1 parent c4967a5 commit 3862570
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webhook_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (wv *WebhookVerifier) Verify(req *http.Request) (bool, error) {
ts := matches[0][1]
h1 := matches[0][2]

const maxBodySize = 2 << 20 // 2 MB

req.Body = http.MaxBytesReader(nil, req.Body, maxBodySize)

body, err := io.ReadAll(req.Body)
if err != nil {
return false, err
Expand Down

0 comments on commit 3862570

Please sign in to comment.