From 1c0aa465248f9468edf941ffad2c493857ece466 Mon Sep 17 00:00:00 2001 From: mkwcat Date: Tue, 6 Feb 2024 19:53:38 -0500 Subject: [PATCH] GameStats: Don't deny requests with invalid hash --- gamestats/web.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gamestats/web.go b/gamestats/web.go index bbccb43..a1a2802 100644 --- a/gamestats/web.go +++ b/gamestats/web.go @@ -18,6 +18,7 @@ import ( func HandleWebRequest(w http.ResponseWriter, r *http.Request) { logging.Info("GSTATS", aurora.Yellow(r.Method), aurora.Cyan(r.URL), "via", aurora.Cyan(r.Host), "from", aurora.BrightCyan(r.RemoteAddr)) + moduleName := "GSTATS:" + r.RemoteAddr u, err := url.Parse(r.URL.String()) if err != nil { @@ -66,9 +67,7 @@ func HandleWebRequest(w http.ResponseWriter, r *http.Request) { expectedHash := hex.EncodeToString(hasher.Sum(nil)) if hash != expectedHash { - logging.Error("GSTATS", "Invalid hash") - replyHTTPError(w, http.StatusUnauthorized, "401 Unauthorized") - return + logging.Warn(moduleName, "Invalid hash") } switch subPath { @@ -76,7 +75,7 @@ func HandleWebRequest(w http.ResponseWriter, r *http.Request) { response = handleGet2(game, query) default: - logging.Warn("GSTATS", "Unhandled path:", aurora.Cyan(subPath)) + logging.Warn(moduleName, "Unhandled path:", aurora.Cyan(subPath)) } // Padding to appease DWC