Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
security: Add request body size limits to notification handlers
rcourtman6eb7f06df176
diff --git a/internal/api/notifications.go b/internal/api/notifications.goindex cbd24f91ec..39e6c387be 100644--- a/internal/api/notifications.go+++ b/internal/api/notifications.go@@ -44,6 +44,9 @@ func (h *NotificationHandlers) GetEmailConfig(w http.ResponseWriter, r *http.Req// UpdateEmailConfig updates the email configurationfunc (h *NotificationHandlers) UpdateEmailConfig(w http.ResponseWriter, r *http.Request) {+ // Limit request body to 32KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 32*1024)+// Read raw body for debuggingbody, err := io.ReadAll(r.Body)if err != nil {@@ -100,6 +103,9 @@ func (h *NotificationHandlers) GetAppriseConfig(w http.ResponseWriter, r *http.R// UpdateAppriseConfig updates the Apprise configuration.func (h *NotificationHandlers) UpdateAppriseConfig(w http.ResponseWriter, r *http.Request) {+ // Limit request body to 64KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 64*1024)+body, err := io.ReadAll(r.Body)if err != nil {http.Error(w, err.Error(), http.StatusBadRequest)@@ -187,6 +193,9 @@ func (h *NotificationHandlers) GetWebhooks(w http.ResponseWriter, r *http.Reques// CreateWebhook creates a new webhookfunc (h *NotificationHandlers) CreateWebhook(w http.ResponseWriter, r *http.Request) {+ // Limit request body to 64KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 64*1024)+// Read the raw body to preserve all fieldsbodyBytes, err := io.ReadAll(r.Body)if err != nil {@@ -244,6 +253,9 @@ func (h *NotificationHandlers) UpdateWebhook(w http.ResponseWriter, r *http.Requreturn}+ // Limit request body to 64KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 64*1024)+// Read the raw body to preserve all fieldsbodyBytes, err := io.ReadAll(r.Body)if err != nil {