auth: silent JWT degradation when Dex is unreachable #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When Dex is unreachable at startup,
NewJWTValidatorreturnsnil, niland emits a warning. All subsequent JWT validation calls silently returnfalse, falling through to the static token check. The resulting 401 gives the caller no indication of whether their JWT was invalid or Dex was unavailable.Files:
cmd/gitea-mcp/main.go:30-33— silent nil return on Dex failureinternal/auth/jwt.go:61-63— Validate returns false when validator is nilSuggestions:
GET /healthzthat reports JWT validator status (enabled/disabled/last-error)503withWWW-Authenticate: Bearer error="temporarily_unavailable"when Dex is known-down vs a generic 401