You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GitHub Issues are currently disabled for this repository, so I am reporting this confirmed bug in Discussions.
What Went Wrong?
Forward Auth in BookLore v2.3.1 fails when an HTTP/1.1 reverse proxy sends configured identity headers using normal canonical or mixed casing.
AuthenticationController.loginRemote() receives the headers as a Map<String, String>, lowercases each configured header name, and then performs a case-sensitive map lookup:
When a proxy sends X-Booklore-User, the request-header map retains that casing, but BookLore looks up x-booklore-user. The result is null, and /api/v1/auth/remote returns HTTP 400 with Remote-User header is missing.
HTTP field names are case-insensitive, so authentication should not depend on their wire casing. The same implementation is still present on the current develop branch.
Have the proxy send normally canonicalized headers:
X-Booklore-User: test-userX-Booklore-Name: Test UserX-Booklore-Email: test@example.invalid
Request GET /api/v1/auth/remote.
BookLore returns HTTP 400. Controller debug output reports all retrieved identity values as null.
Repeat with the same header names entirely lowercase on the wire:
x-booklore-user: test-userx-booklore-name: Test Userx-booklore-email: test@example.invalid
Remote authentication succeeds.
This was also isolated with a raw HTTP/1.1 request: a lowercase diagnostic email header was visible to AuthenticationController, while the same normally canonicalized header was null.
Expected Behavior
BookLore should resolve configured Forward Auth headers case-insensitively, regardless of whether a proxy emits lowercase, Title-Case, or other valid mixed casing.
{"message":"Remote-User header is missing","status":400}
Suggested Fix
Use a case-insensitive header abstraction rather than lowercasing a key and looking it up in a potentially case-sensitive Map. For example, accept Spring HttpHeaders and use getFirst(configuredHeaderName), or use another explicitly case-insensitive lookup.
Please add controller tests covering lowercase, canonical Title-Case, and arbitrary mixed-case header names for user, name, email, and groups.
Environment
BookLore: v2.3.1
OS: Ubuntu Linux
Browser: Browser-independent; reproduced at the HTTP API layer
Installation: Docker Compose
Reverse proxy: Go net/http, HTTP/1.1 upstream
Storage: Local SSD
I searched existing reports. Related but distinct: PR #3078 handles Authorization-header casing in the Kobo proxy path; this report concerns Forward Auth header lookup in AuthenticationController.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
What Went Wrong?
Forward Auth in BookLore v2.3.1 fails when an HTTP/1.1 reverse proxy sends configured identity headers using normal canonical or mixed casing.
AuthenticationController.loginRemote()receives the headers as aMap<String, String>, lowercases each configured header name, and then performs a case-sensitive map lookup:When a proxy sends
X-Booklore-User, the request-header map retains that casing, but BookLore looks upx-booklore-user. The result isnull, and/api/v1/auth/remotereturns HTTP 400 withRemote-User header is missing.HTTP field names are case-insensitive, so authentication should not depend on their wire casing. The same implementation is still present on the current
developbranch.How Can We Reproduce This?
Run BookLore v2.3.1 with Forward Auth enabled:
Place BookLore behind an HTTP/1.1 reverse proxy.
Have the proxy send normally canonicalized headers:
Request
GET /api/v1/auth/remote.BookLore returns HTTP 400. Controller debug output reports all retrieved identity values as
null.Repeat with the same header names entirely lowercase on the wire:
Remote authentication succeeds.
This was also isolated with a raw HTTP/1.1 request: a lowercase diagnostic email header was visible to
AuthenticationController, while the same normally canonicalized header wasnull.Expected Behavior
BookLore should resolve configured Forward Auth headers case-insensitively, regardless of whether a proxy emits lowercase, Title-Case, or other valid mixed casing.
Sanitized Error Evidence
{"message":"Remote-User header is missing","status":400}Suggested Fix
Use a case-insensitive header abstraction rather than lowercasing a key and looking it up in a potentially case-sensitive
Map. For example, accept SpringHttpHeadersand usegetFirst(configuredHeaderName), or use another explicitly case-insensitive lookup.Please add controller tests covering lowercase, canonical Title-Case, and arbitrary mixed-case header names for user, name, email, and groups.
Environment
net/http, HTTP/1.1 upstreamI searched existing reports. Related but distinct: PR #3078 handles Authorization-header casing in the Kobo proxy path; this report concerns Forward Auth header lookup in
AuthenticationController.All reactions