fix(phase-4): add DB error checking, mask sensitive auth tokens in API and middleware logs
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

This commit is contained in:
newkirk
2026-07-21 13:23:02 -04:00
parent 700b7cd5d6
commit a187d8e20e
4 changed files with 39 additions and 13 deletions
+5 -1
View File
@@ -72,7 +72,11 @@ func AuthMiddleware(database *db.DB, requireAuth bool) gin.HandlerFunc {
c.Next()
} else {
log.Printf("Token not found, inactive or error in DB: %s (err: %v)", token, err)
maskedToken := "••••"
if len(token) > 8 {
maskedToken = token[:3] + "••••" + token[len(token)-4:]
}
log.Printf("Token not found, inactive or error in DB: %s (err: %v)", maskedToken, err)
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{
"error": gin.H{
"message": "Invalid or inactive client token.",