Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix auth validation (when no creds are configured in settings) issue in 3rd party bounce providers.

Kailash Nadh80d93e3c3152
diff --git a/internal/bounce/webhooks/forwardemail.go b/internal/bounce/webhooks/forwardemail.go
index e08c5e96..2f73f6d2 100644
--- a/internal/bounce/webhooks/forwardemail.go
+++ b/internal/bounce/webhooks/forwardemail.go
@@ -47,6 +47,10 @@ func NewForwardemail(key []byte) *Forwardemail {
}
func (p *Forwardemail) ProcessBounce(sigHex string, body []byte) ([]models.Bounce, error) {
+ if len(p.hmacKey) == 0 {
+ return nil, errors.New("webhook key is not configured")
+ }
+
// Decode the hex-encoded signature from the webhook
sig, err := hex.DecodeString(sigHex)
if err != nil {
diff --git a/internal/bounce/webhooks/lettermint.go b/internal/bounce/webhooks/lettermint.go
index 235918d2..36352131 100644
--- a/internal/bounce/webhooks/lettermint.go
+++ b/internal/bounce/webhooks/lettermint.go
@@ -43,6 +43,10 @@ func NewLettermint(key []byte) *Lettermint {
// ProcessBounce processes an incoming Lettermint webhook payload and returns a bounce object.
func (l *Lettermint) ProcessBounce(sig string, body []byte) ([]models.Bounce, error) {
+ if len(l.hmacKey) == 0 {
+ return nil, fmt.Errorf("webhook key is not configured")
+ }
+
// Parse the signature header: t={timestamp},v1={hex_signature}.
ts, sigHex, err := parseLettermintSignature(sig)
if err != nil {
diff --git a/internal/bounce/webhooks/postmark.go b/internal/bounce/webhooks/postmark.go
index 00f3c626..156d2bb7 100644
--- a/internal/bounce/webhooks/postmark.go
+++ b/internal/bounce/webhooks/postmark.go
@@ -3,6 +3,7 @@ package webhooks
import (
"crypto/subtle"
"encoding/json"
+ "errors"
"fmt"
"strings"
"time"
@@ -106,7 +107,7 @@ func makePostmarkAuthHandler(cfgUser, cfgPassword string) func(username, passwor
return func(username, password string, c echo.Context) (bool, error) {
if len(u) == 0 || len(p) == 0 {
- return true, nil
+ return false, errors.New("webhook credentials are not configured")
}
if subtle.ConstantTimeCompare([]byte(username), u) == 1 && subtle.ConstantTimeCompare([]byte(password), p) == 1 {