Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

security: enforce scope checks for AI approvals and config management

rcourtman8f92273e3326
diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.go
index b722b705f5..4cdbbd8066 100644
--- a/internal/api/ai_handlers.go
+++ b/internal/api/ai_handlers.go
@@ -4763,6 +4763,11 @@ func (h *AISettingsHandler) HandleApproveCommand(w http.ResponseWriter, r *http.
return
}
+ // SECURITY: Validating command execution scope
+ if !ensureScope(w, r, config.ScopeAIExecute) {
+ return
+ }
+
// Extract ID from path: /api/ai/approvals/{id}/approve
path := strings.TrimPrefix(r.URL.Path, "/api/ai/approvals/")
path = strings.TrimSuffix(path, "/approve")
diff --git a/internal/api/config_handlers.go b/internal/api/config_handlers.go
index dff5e47253..e62b08191b 100644
--- a/internal/api/config_handlers.go
+++ b/internal/api/config_handlers.go
@@ -3400,6 +3400,11 @@ func (h *ConfigHandlers) HandleExportConfig(w http.ResponseWriter, r *http.Reque
// Limit request body to 8KB to prevent memory exhaustion
r.Body = http.MaxBytesReader(w, r.Body, 8*1024)
+ // SECURITY: Validating scope for config export
+ if !ensureScope(w, r, config.ScopeSettingsRead) {
+ return
+ }
+
var req ExportConfigRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
log.Error().Err(err).Msg("Failed to decode export request")
@@ -3442,6 +3447,11 @@ func (h *ConfigHandlers) HandleImportConfig(w http.ResponseWriter, r *http.Reque
// Limit request body to 1MB to prevent memory exhaustion (config imports can be large)
r.Body = http.MaxBytesReader(w, r.Body, 1024*1024)
+ // SECURITY: Validating scope for config import
+ if !ensureScope(w, r, config.ScopeSettingsWrite) {
+ return
+ }
+
var req ImportConfigRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
log.Error().Err(err).Msg("Failed to decode import request")