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 remaining API handlers
rcourtmancf26ed7f1241
diff --git a/internal/api/docker_metadata.go b/internal/api/docker_metadata.goindex 579a819f9f..7ebe5907f5 100644--- a/internal/api/docker_metadata.go+++ b/internal/api/docker_metadata.go@@ -78,6 +78,9 @@ func (h *DockerMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *hreturn}+ // Limit request body to 16KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 16*1024)+var meta config.DockerMetadataif err := json.NewDecoder(r.Body).Decode(&meta); err != nil {http.Error(w, "Invalid request body", http.StatusBadRequest)diff --git a/internal/api/guest_metadata.go b/internal/api/guest_metadata.goindex 863142467c..3a567225c7 100644--- a/internal/api/guest_metadata.go+++ b/internal/api/guest_metadata.go@@ -83,6 +83,9 @@ func (h *GuestMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *htreturn}+ // Limit request body to 16KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 16*1024)+var meta config.GuestMetadataif err := json.NewDecoder(r.Body).Decode(&meta); err != nil {http.Error(w, "Invalid request body", http.StatusBadRequest)diff --git a/internal/api/host_agents.go b/internal/api/host_agents.goindex 7931ded131..2fdad40f84 100644--- a/internal/api/host_agents.go+++ b/internal/api/host_agents.go@@ -37,6 +37,8 @@ func (h *HostAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Request)return}+ // Limit request body to 256KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 256*1024)defer r.Body.Close()var report agentshost.Reportdiff --git a/internal/api/notification_queue.go b/internal/api/notification_queue.goindex 99184d9b05..2d04ffa99e 100644--- a/internal/api/notification_queue.go+++ b/internal/api/notification_queue.go@@ -85,6 +85,9 @@ func (h *NotificationQueueHandlers) RetryDLQItem(w http.ResponseWriter, r *http.return}+ // Limit request body to 8KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 8*1024)+var request struct {ID string `json:"id"`}@@ -129,6 +132,9 @@ func (h *NotificationQueueHandlers) DeleteDLQItem(w http.ResponseWriter, r *httpreturn}+ // Limit request body to 8KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 8*1024)+var request struct {ID string `json:"id"`}diff --git a/internal/api/system_settings.go b/internal/api/system_settings.goindex ab5644384c..2e5e288f6f 100644--- a/internal/api/system_settings.go+++ b/internal/api/system_settings.go@@ -462,6 +462,9 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWriterexistingSettings = config.DefaultSystemSettings()}+ // Limit request body to 64KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 64*1024)+// Read the request body into a map to check which fields were providedvar rawRequest map[string]interface{}if err := json.NewDecoder(r.Body).Decode(&rawRequest); err != nil {diff --git a/internal/api/temperature_proxy.go b/internal/api/temperature_proxy.goindex c5021ba52d..135b686ce2 100644--- a/internal/api/temperature_proxy.go+++ b/internal/api/temperature_proxy.go@@ -176,6 +176,8 @@ func (h *TemperatureProxyHandlers) HandleRegister(w http.ResponseWriter, r *httpreturn}+ // Limit request body to 8KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 8*1024)defer r.Body.Close()var req struct {diff --git a/internal/api/updates.go b/internal/api/updates.goindex 4d121588b4..8f382d7be9 100644--- a/internal/api/updates.go+++ b/internal/api/updates.go@@ -83,6 +83,9 @@ func (h *UpdateHandlers) HandleApplyUpdate(w http.ResponseWriter, r *http.Requesreturn}+ // Limit request body to 8KB to prevent memory exhaustion+ r.Body = http.MaxBytesReader(w, r.Body, 8*1024)+var req struct {DownloadURL string `json:"downloadUrl"`}