Skip to content

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

Validate `type` in bounce webhook API.

Kailash Nadh27e1e83d0baa
diff --git a/cmd/bounce.go b/cmd/bounce.go
index 1ed87e8b..f32ec509 100644
--- a/cmd/bounce.go
+++ b/cmd/bounce.go
@@ -239,6 +239,10 @@ func validateBounceFields(b models.Bounce, app *App) error {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidData"))
}
+ if b.Type != models.BounceTypeHard && b.Type != models.BounceTypeSoft {
+ return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidData"))
+ }
+
if b.Email != "" && !subimporter.IsEmail(b.Email) {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidEmail"))
}