auth: CallerMiddleware header priority order is undocumented #10

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

CallerMiddleware checks X-Auth-Request-User first, then falls back to X-Forwarded-User. If a future auth proxy sets both headers (e.g. oauth2-proxy in some configs does), behaviour is undefined and untested.

File: internal/auth/caller.go:10-18

Suggestions:

  • Add a comment documenting which header takes precedence and why
  • Add a unit test covering the both-present scenario
  • Consider logging a warning when both are present and differ
`CallerMiddleware` checks `X-Auth-Request-User` first, then falls back to `X-Forwarded-User`. If a future auth proxy sets both headers (e.g. oauth2-proxy in some configs does), behaviour is undefined and untested. **File:** `internal/auth/caller.go:10-18` **Suggestions:** - Add a comment documenting which header takes precedence and why - Add a unit test covering the both-present scenario - Consider logging a warning when both are present and differ
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#10