don't initialize log entry until after cookie check

This commit is contained in:
kim 2025-04-24 11:21:48 +01:00
commit 5377b22bff

View file

@ -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")