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.

Fix KubernetesCluster RBAC slice race and align SECURITY.md sensor-wrapper guidance

rcourtmane327e0994570
diff --git a/SECURITY.md b/SECURITY.md
index 3a7252fb4c..4d89633395 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -92,7 +92,8 @@ docker exec pulse rm -rf /home/pulse/.ssh/id_ed25519*
If you fully understand the risk and are **not** containerized (VM/bare-metal
install), the legacy SSH flow still works. Use a dedicated monitoring user,
-restrict the key with `command="sensors -j"` and `from="<pulse-ip>"`, and
+restrict the key to the Pulse sensor wrapper with
+`command="/usr/local/sbin/pulse-sensors"` and `from="<pulse-ip>"`, and
rotate keys regularly.
#### Auditing Your Deployment
diff --git a/internal/models/deepcopy.go b/internal/models/deepcopy.go
index f56445e11c..9f4e38fd2b 100644
--- a/internal/models/deepcopy.go
+++ b/internal/models/deepcopy.go
@@ -934,6 +934,14 @@ func cloneKubernetesCluster(src KubernetesCluster) KubernetesCluster {
dest.PodDisruptionBudgets = cloneKubernetesPodDisruptionBudgets(src.PodDisruptionBudgets)
dest.HorizontalPodAutoscalers = cloneKubernetesHorizontalPodAutoscalers(src.HorizontalPodAutoscalers)
dest.Events = cloneKubernetesEvents(src.Events)
+ // RBAC slices: NormalizeCollections() mutates these via index
+ // assignment (c.Roles[i] = c.Roles[i].NormalizeCollections()), so they
+ // must not be aliased to the source slice or concurrent clones will
+ // race on the shared underlying array.
+ dest.Roles = append([]KubernetesRole(nil), src.Roles...)
+ dest.ClusterRoles = append([]KubernetesClusterRole(nil), src.ClusterRoles...)
+ dest.RoleBindings = append([]KubernetesRoleBinding(nil), src.RoleBindings...)
+ dest.ClusterRoleBindings = append([]KubernetesClusterRoleBinding(nil), src.ClusterRoleBindings...)
dest.TokenLastUsedAt = cloneTimePtr(src.TokenLastUsedAt)
return dest.NormalizeCollections()
}