From 5377b22bfff53b51134fc7f9e96fba20fdb2bed1 Mon Sep 17 00:00:00 2001 From: kim Date: Thu, 24 Apr 2025 11:21:48 +0100 Subject: [PATCH] don't initialize log entry until after cookie check --- internal/middleware/nollamas.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/middleware/nollamas.go b/internal/middleware/nollamas.go index 115c81acc..64490101d 100644 --- a/internal/middleware/nollamas.go +++ b/internal/middleware/nollamas.go @@ -132,10 +132,6 @@ func (m *nollamas) Serve(c *gin.Context) { token[:len(token)/4] + token[:len(token)/4] - // Prepare new log entry with challenge. - l := log.WithContext(c.Request.Context()) - l = l.WithField("challenge", challenge) - // Check for a provided success token. cookie, _ := c.Cookie("gts-nollamas") @@ -152,6 +148,10 @@ func (m *nollamas) Serve(c *gin.Context) { return } + // Prepare new log entry with challenge. + l := log.WithContext(c.Request.Context()) + l = l.WithField("challenge", challenge) + // Check query to see if an in-progress // challenge solution has been provided. nonce, _ := c.GetQuery("nollamas_solution")