fix: address code review findings

This commit is contained in:
Mrixs committed 2026-08-17 22:14:48 +03:00
1 parent 777fda95a3
commit 78f662c985
5 files changed
+29 -28

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
package main
import (
"crypto/hmac"
"encoding/json"
"fmt"
"net/http"
@@ -433,7 +434,7 @@ func adminAuth(hc *HandlerContext, w http.ResponseWriter, r *http.Request) bool
return false
}
providedAPIKey := r.Header.Get("X-Admin-Api-Key")
if providedAPIKey != expectedAPIKey {
if !hmac.Equal([]byte(providedAPIKey), []byte(expectedAPIKey)) {
http.Error(w, "unauthorized: admin API key required", http.StatusUnauthorized)
return false
}