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(webhooks): test button in edit form sends redacted headers (#1273)

rcourtman6c78d78fc785
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index d59e69b10d..9a45da9904 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -3279,8 +3279,13 @@ function DestinationsTab(props: DestinationsTabProps) {
setTestingWebhook(webhookId);
try {
if (webhookData) {
- // Test unsaved webhook with provided configuration
- await NotificationsAPI.testWebhook(webhookData);
+ // Test unsaved webhook with provided configuration.
+ // Include the ID so the backend can merge redacted header/field values
+ // with the saved originals (headers are masked with ***REDACTED*** on load).
+ const payload = webhookId && webhookId !== 'temp-new-webhook'
+ ? { ...webhookData, id: webhookId }
+ : webhookData;
+ await NotificationsAPI.testWebhook(payload);
} else {
// Test existing webhook by ID
await NotificationsAPI.testNotification({ type: 'webhook', webhookId });
diff --git a/internal/api/notifications.go b/internal/api/notifications.go
index 23cc3faf75..04ed7a7f5a 100644
--- a/internal/api/notifications.go
+++ b/internal/api/notifications.go
@@ -657,6 +657,33 @@ func (h *NotificationHandlers) TestWebhook(w http.ResponseWriter, r *http.Reques
return
}
+ // If testing an existing webhook, merge redacted header/custom field values
+ // with the saved originals (the frontend masks them with ***REDACTED*** on load)
+ if basicWebhook.ID != "" {
+ existingWebhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
+ for _, existing := range existingWebhooks {
+ if existing.ID == basicWebhook.ID {
+ if len(basicWebhook.Headers) > 0 && len(existing.Headers) > 0 {
+ for _, v := range basicWebhook.Headers {
+ if v == "***REDACTED***" {
+ basicWebhook.Headers = existing.Headers
+ break
+ }
+ }
+ }
+ if len(basicWebhook.CustomFields) > 0 && len(existing.CustomFields) > 0 {
+ for _, v := range basicWebhook.CustomFields {
+ if v == "***REDACTED***" {
+ basicWebhook.CustomFields = existing.CustomFields
+ break
+ }
+ }
+ }
+ break
+ }
+ }
+ }
+
// Convert to enhanced webhook for testing
webhook := notifications.EnhancedWebhookConfig{
WebhookConfig: basicWebhook,