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.

Correct webhook merge helper and test boundaries

pulse-triage[bot]a3a83b1e42b8
diff --git a/internal/api/alerting/notifications.go b/internal/api/alerting/notifications.go
index 4cacf0a244..d2d960dcc6 100644
--- a/internal/api/alerting/notifications.go
+++ b/internal/api/alerting/notifications.go
@@ -598,12 +598,12 @@ func (h *NotificationHandlers) UpdateWebhook(w http.ResponseWriter, r *http.Requ
if routingPresence.MinimumSeverity == nil {
webhook.MinimumSeverity = existing.MinimumSeverity
}
- webhook.Headers, err = restoreMaskedWebhookValues(webhook.Headers, existing.Headers, true)
+ webhook.Headers, err = restoreStrictMaskedWebhookValues(webhook.Headers, existing.Headers, true)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
- webhook.CustomFields, err = restoreMaskedWebhookValues(webhook.CustomFields, existing.CustomFields, false)
+ webhook.CustomFields, err = restoreStrictMaskedWebhookValues(webhook.CustomFields, existing.CustomFields, false)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
diff --git a/internal/api/alerting/notifications_test.go b/internal/api/alerting/notifications_test.go
index 34e5599ea4..b225b6ecf1 100644
--- a/internal/api/alerting/notifications_test.go
+++ b/internal/api/alerting/notifications_test.go
@@ -1722,6 +1722,8 @@ func TestWebhookMaskedEditPersistsAndDelivers(t *testing.T) {
})
}
}
+}
+
// The webhook editor sends back the masked values GetWebhooks returned for
// every header, custom field and signing secret the user did not retype. Each
// masked value must resolve to its own saved value: never to the mask itself,
@@ -1798,7 +1800,7 @@ func TestWebhookMaskedValuesResolvePerKey(t *testing.T) {
body, _ := json.Marshal(map[string]interface{}{
"name": "Ops", "url": saved.URL, "enabled": true, "service": "pushover",
// Content-Type cleared in the editor; known masked values stay saved.
- // Unknown masks are rejected by TestWebhookEditPreservesOnlyMaskedValues.
+ // Unknown masks are rejected by TestWebhookEditPreservesOnlyMaskedValues.
"headers": map[string]string{"Authorization": "***REDACTED***", "Content-Type": ""},
"customFields": map[string]string{"token": "***REDACTED***", "user": "***REDACTED***"},
})