From a161c5447487553708a154e5c8e57777296199f3 Mon Sep 17 00:00:00 2001 From: Andy Doan Date: Thu, 14 Dec 2023 11:51:57 -0600 Subject: [PATCH] Make validateRequest handling more foolproof Signed-off-by: Andy Doan --- http_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http_handlers.go b/http_handlers.go index f055779..9221d21 100644 --- a/http_handlers.go +++ b/http_handlers.go @@ -28,7 +28,7 @@ func RegisterEchoHandlers(svcHandler ServiceHandler, e *echo.Echo) { return c.String(http.StatusInternalServerError, err.Error()) } bytes, err := validateRequest(svc, c) - if err != nil { + if err != nil || bytes == nil { // validateRequest failed and sent the response return err } bytes, err = svc.Enroll(c.Request().Context(), bytes) @@ -46,7 +46,7 @@ func RegisterEchoHandlers(svcHandler ServiceHandler, e *echo.Echo) { return c.String(http.StatusInternalServerError, err.Error()) } bytes, err := validateRequest(svc, c) - if bytes == nil { // validateRequest failed and sent the response + if err != nil || bytes == nil { // validateRequest failed and sent the response return err } peerCerts := c.Request().TLS.PeerCertificates