From 1c4f2d1851c3b895c3d69be25aac43fd6984449a Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 14 Apr 2025 19:37:52 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xe Iaso --- lib/anubis.go | 2 +- lib/verifier.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/anubis.go b/lib/anubis.go index 74d096fd..762c6aab 100644 --- a/lib/anubis.go +++ b/lib/anubis.go @@ -498,7 +498,7 @@ func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) { validator, ok := s.validators[string(rule.Challenge.Algorithm)] if !ok { s.ClearCookie(w) - lg.Debug("nonce doesn't parse", "err", err) + lg.Debug("no validator found for algorithm", "algorithm", rule.Challenge.Algorithm) templ.Handler(web.Base("Oh noes!", web.ErrorPage(fmt.Sprintf("Internal anubis error has been detected and you cannot proceed. Tried to look up a validator for algorithm %s but wasn't able to find one. Please contact the administrator of this instance of anubis", rule.Challenge.Algorithm), s.opts.WebmasterEmail)), templ.WithStatus(http.StatusInternalServerError)).ServeHTTP(w, r) return } diff --git a/lib/verifier.go b/lib/verifier.go index 07e1518a..3c28c140 100644 --- a/lib/verifier.go +++ b/lib/verifier.go @@ -33,7 +33,7 @@ func BasicSHA256Verify(ctx context.Context, challenge, verify []byte, nonce, dif } if !hasLeadingZeroNibbles(data, difficulty) { - return false, fmt.Errorf("%w: wanted %d leading zeroes in calculated data %x, but did not get it", ErrWrongChallengeDifficulty, data, difficulty) + return false, fmt.Errorf("%w: wanted %d leading zeroes in calculated data %x, but did not get it", ErrWrongChallengeDifficulty, difficulty, data) } if !hasLeadingZeroNibbles(verify, difficulty) {