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.

Keep invalid webhook retry hints out of diagnostic logs

pulse-triage[bot]398eb589383e
diff --git a/docs/release-control/v6/internal/subsystems/notifications.md b/docs/release-control/v6/internal/subsystems/notifications.md
index bdb750c8bc..cc0210a930 100644
--- a/docs/release-control/v6/internal/subsystems/notifications.md
+++ b/docs/release-control/v6/internal/subsystems/notifications.md
@@ -23,7 +23,10 @@ body bytes. Logs, delivery errors/history and the existing Test response carry
structured status, bounded byte counts and incomplete/limit-reached facts, not
arbitrary receiver text. Test keeps its status/string/error shape; a nonempty
response string now explains that the body was withheld. ResponseLogging
-enables metadata only. Reaching the read cap does not claim the body exceeded it.
+enables metadata only. Invalid Retry-After hints retain the fixed fallback
+diagnostic without copying the receiver's arbitrary header value. Valid hints
+still report their parsed bounded duration. Reaching the read cap does not
+claim the body exceeded it.
HTTP status still owns rejection classification and retry decisions, Retry-After
and actual attempt/final-status accounting survive, and incomplete 2xx replies
@@ -37,7 +40,9 @@ historical diagnostics are not rewritten or claimed to be scrubbed.
ntfy/retry senders with in-memory HTTP responses: echoed credentials/alert text,
successful/rejected responses, error-prose disclosure, final delivery history,
unchanged requests and response closure. `webhook_response_metadata_test.go`
-checks empty/incomplete/at-cap/over-cap bodies and the Test summary. Existing
+checks empty/incomplete/at-cap/over-cap bodies and the Test summary.
+`webhook_response_retry_hint_test.go` preserves actual retry/fallback behaviour
+without disclosing invalid hint text. Existing
Test/Gotify and ntfy HTTP-error controls retain status and request expectations
with the new withheld response. These are synthetic source controls, not native
provider acceptance or a cause/fix claim for reported notification failures.
diff --git a/internal/notifications/webhook_enhanced.go b/internal/notifications/webhook_enhanced.go
index 6b36cfcc49..23f9b4d641 100644
--- a/internal/notifications/webhook_enhanced.go
+++ b/internal/notifications/webhook_enhanced.go
@@ -336,7 +336,6 @@ func (n *NotificationManager) sendWebhookWithRetry(webhook EnhancedWebhookConfig
} else {
log.Debug().
Str("webhook", webhook.Name).
- Str("retryAfter", retryAfter).
Msg("invalid Retry-After header; falling back to exponential backoff")
}
}
diff --git a/internal/notifications/webhook_response_retry_hint_test.go b/internal/notifications/webhook_response_retry_hint_test.go
new file mode 100644
index 0000000000..5d3d526a95
--- /dev/null
+++ b/internal/notifications/webhook_response_retry_hint_test.go
@@ -0,0 +1,35 @@
+package notifications
+
+import (
+ "fmt"
+ "io"
+ "net/http"
+ "strings"
+ "testing"
+)
+
+func TestWebhookResponseConfidentialityInvalidRetryHint(t *testing.T) {
+ for _, finalCode := range []int{http.StatusForbidden, http.StatusAccepted} {
+ t.Run(fmt.Sprint(finalCode), func(t *testing.T) {
+ captured := captureWebhookResponseLogs(t)
+ attempts := 0
+ n := responseFixtureManager(t, func(*http.Request) (*http.Response, error) {
+ attempts++
+ code := http.StatusTooManyRequests
+ if attempts > 1 {
+ code = finalCode
+ }
+ return &http.Response{StatusCode: code, Header: http.Header{"Retry-After": {webhookResponsePrivateText}},
+ Body: io.NopCloser(strings.NewReader(""))}, nil
+ })
+ err := n.sendWebhookWithRetry(EnhancedWebhookConfig{
+ WebhookConfig: WebhookConfig{Name: "response fixture", URL: "http://127.0.0.1/hook"}, RetryCount: 1,
+ }, []byte(`{}`), "fixture:alert")
+ if attempts != 2 || (err == nil) != (finalCode == http.StatusAccepted) ||
+ !strings.Contains(captured.String(), "invalid Retry-After header; falling back to exponential backoff") {
+ t.Fatalf("invalid hint changed fallback or verdict: attempts=%d error=%v", attempts, err)
+ }
+ assertWithheldWebhookResponse(t, captured, err)
+ })
+ }
+}