From d1437185419b346984a2e178826723267dd995f8 Mon Sep 17 00:00:00 2001 From: Dave Protasowski Date: Fri, 29 May 2026 12:19:47 -0400 Subject: [PATCH] Limit the webhook request body size to 3MiB --- webhook/webhook.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webhook/webhook.go b/webhook/webhook.go index 866729047f..44c6066b50 100644 --- a/webhook/webhook.go +++ b/webhook/webhook.go @@ -395,7 +395,9 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - wh.mux.ServeHTTP(w, r) + const MaxBodySize = 3 * 1024 * 1024 // 3 MiB + h := http.MaxBytesHandler(&wh.mux, MaxBodySize) + h.ServeHTTP(w, r) } type routeLabeler struct {