Fix nil pointer panic in local auth mode #1
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#2 Sign session tokens with HMAC
austin/vektor
#13 Extract service/store layer from API handlers
austin/vektor
Reference
austin/vektor#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Description
server.go:55callss.auth.Middleware()unconditionally. When running in local auth mode,s.authis nil, so this panics on any authenticated API request.What needs to happen
Define an
Authenticatorinterface withMiddleware(http.Handler) http.HandlerandValidateSession(token string) (*Claims, error)methods. BothAuth(OIDC) andLocalshould implement it. TheServerstruct stores the interface, not concrete types.The session logic (
CreateSessionToken,validateSessionininternal/auth/oidc.go) is already auth-mode-agnostic — it just does base64 JSON, nothing OIDC-specific. Extract it to a shared location that both auth modes can use.Key files
internal/api/server.go— the panic site (line 55) and route setupinternal/auth/oidc.go— session functions andMiddlewaremethodinternal/auth/local.go— needsMiddlewareand session validation added