auth: no audit logging of authentication failures #9

Open
opened 2026-05-14 08:44:17 +00:00 by mathias · 0 comments
Owner

Failed auth attempts are silently dropped — no structured log entry, no forensic trail. Impossible to distinguish a misconfigured client from a brute-force attempt after the fact.

File: internal/auth/bearer.go:22-42

Suggestion: On every 401, emit a structured log line with:

  • Failure reason (jwt_invalid, jwt_dex_unavailable, static_token_mismatch, no_token)
  • Remote IP
  • Token type attempted (JWT vs static)
  • First 8 chars of the presented token (enough to correlate client, not enough to reconstruct)
  • Timestamp
Failed auth attempts are silently dropped — no structured log entry, no forensic trail. Impossible to distinguish a misconfigured client from a brute-force attempt after the fact. **File:** `internal/auth/bearer.go:22-42` **Suggestion:** On every 401, emit a structured log line with: - Failure reason (`jwt_invalid`, `jwt_dex_unavailable`, `static_token_mismatch`, `no_token`) - Remote IP - Token type attempted (JWT vs static) - First 8 chars of the presented token (enough to correlate client, not enough to reconstruct) - Timestamp
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#9