Skip to content

fix: prevent nil pointer crash in BounceWebhook when bounce processing disabled#2993

Open
Koushik-1729 wants to merge 1 commit intoknadh:masterfrom
Koushik-1729:fix/bounce-webhook-nil-check
Open

fix: prevent nil pointer crash in BounceWebhook when bounce processing disabled#2993
Koushik-1729 wants to merge 1 commit intoknadh:masterfrom
Koushik-1729:fix/bounce-webhook-nil-check

Conversation

@Koushik-1729
Copy link
Copy Markdown

Summary

  • Adds nil check for a.bounce at the start of BounceWebhook
  • Returns HTTP 503 with error message instead of crashing
  • Prevents nil pointer dereference for all providers (SES, SendGrid, Postmark, ForwardEmail, Lettermint)

Fixes #2983

Root Cause

Commit f1649b3 changed validation from config booleans to nil checks on bounce manager fields. When bounce.enabled is false, a.bounce is never instantiated, causing a nil pointer crash on any webhook request to /api/webhooks/bounce/:service.

Changes

  • Added nil check for a.bounce at the beginning of BounceWebhook in cmd/bounce.go
  • Returns http.StatusServiceUnavailable (503) with an appropriate error message when bounce processing is not enabled
  • Fixed misleading comment on the function (was referencing template preview)

Testing

  • When bounce.enabled = false: webhook requests return 503 instead of crashing
  • When bounce.enabled = true: no behavioral change, existing flow unchanged

…g disabled

Adds a nil check for a.bounce at the start of BounceWebhook to return
HTTP 503 instead of crashing with a nil pointer dereference when bounce
processing is not enabled.

Fixes knadh#2983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bounce webhook crashes when bounce processing is disabled

2 participants