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
Keep plain notification errors readable in the delivery log
rcourtman7904e5fcc9f9
diff --git a/internal/api/alerting/notifications_health_test.go b/internal/api/alerting/notifications_health_test.goindex 7d41140440..be2c2f37d9 100644--- a/internal/api/alerting/notifications_health_test.go+++ b/internal/api/alerting/notifications_health_test.go@@ -333,6 +333,7 @@ func containsAny(value string, needles ...string) bool {func TestGetDeliveryLogDiagnosticContext(t *testing.T) {for _, tc := range []struct{ name, input, want string }{{"plain", "connection refused", "connection refused"},+ {"apprise CLI", `process queued apprise notification "apprise-1" (alert): apprise CLI send failed: execute apprise CLI: executable file not found in PATH`, `process queued apprise notification "apprise-1" (alert): apprise CLI send failed: execute apprise CLI: executable file not found in PATH`},{"encoded repeated query", "Post https://example.test/hook?%74oken=secret&token=secret&channel=ops failed", "Post https://example.test/hook?%74oken=REDACTED&token=REDACTED&channel=ops failed"},{"userinfo", "Post https://user:[email protected]/hook: timeout", "Post https://[email protected]/hook: timeout"},{"malformed", "Post https://user:[email protected]/%zz: timeout", "[invalid webhook URL]"},diff --git a/internal/notifications/webhook_url_redaction.go b/internal/notifications/webhook_url_redaction.goindex 3de87fddda..8ba5a7550c 100644--- a/internal/notifications/webhook_url_redaction.go+++ b/internal/notifications/webhook_url_redaction.go@@ -125,12 +125,42 @@ func RedactWebhookDiagnosticSecrets(message string) string {}if !foundURL {- return RedactWebhookURLSecrets(message)+ return redactSchemelessDiagnosticSecrets(message)}redacted.WriteString(message[cursor:])return redacted.String()}+// redactSchemelessDiagnosticSecrets handles text with no http(s) URL. Only+// words that could hold a path or query credential are parsed, and a+// malformed one still fails closed. Parsing the whole message as one URL+// replaced ordinary error prose such as "execute apprise CLI: executable file+// not found in PATH" with the invalid-URL marker, because a colon before the+// first slash is not a valid relative URL.+func redactSchemelessDiagnosticSecrets(message string) string {+ var redacted strings.Builder+ rest := message+ for {+ end := strings.IndexAny(rest, " \t\r\n")+ if end == -1 {+ end = len(rest)+ }+ word := rest[:end]+ if strings.ContainsAny(word, "/?") {+ word = RedactWebhookURLSecrets(word)+ if word == invalidWebhookURLDiagnostic {+ return invalidWebhookURLDiagnostic+ }+ }+ redacted.WriteString(word)+ if end == len(rest) {+ return redacted.String()+ }+ redacted.WriteByte(rest[end])+ rest = rest[end+1:]+ }+}+func redactWebhookTransportError(err error) error {if err == nil {return nildiff --git a/internal/notifications/webhook_url_redaction_test.go b/internal/notifications/webhook_url_redaction_test.goindex 284a266603..b37cb46d22 100644--- a/internal/notifications/webhook_url_redaction_test.go+++ b/internal/notifications/webhook_url_redaction_test.go@@ -128,6 +128,26 @@ func TestRedactWebhookDiagnosticSecrets(t *testing.T) {input: "post https://hook-user:[email protected]/%zz failed",want: invalidWebhookURLDiagnostic,},+ "apprise CLI prose": {+ input: `process queued apprise notification "apprise-1" (alert): apprise CLI send failed: execute apprise CLI: executable file not found in PATH`,+ want: `process queued apprise notification "apprise-1" (alert): apprise CLI send failed: execute apprise CLI: executable file not found in PATH`,+ },+ "smtp prose": {+ input: `process queued email notification "email-1" (alert): smtp: 535 5.7.8 authentication failed`,+ want: `process queued email notification "email-1" (alert): smtp: 535 5.7.8 authentication failed`,+ },+ "schemeless query credential in prose": {+ input: "send failed: hooks.example.test/notify?token=supersecret refused",+ want: "send failed: hooks.example.test/notify?token=REDACTED refused",+ },+ "schemeless bot path in prose": {+ input: "send failed: api.telegram.org/bot123:telegram-secret/sendMessage refused",+ want: "send failed: api.telegram.org/botREDACTED/sendMessage refused",+ },+ "malformed schemeless word": {+ input: "send failed: hooks.example.test/notify?%zz=secret refused",+ want: invalidWebhookURLDiagnostic,+ },}for name, test := range tests {