diff --git a/webhook/webhook.go b/webhook/webhook.go index e8895db75e..b8ff962e56 100644 --- a/webhook/webhook.go +++ b/webhook/webhook.go @@ -394,5 +394,7 @@ 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) }