8000 Fix #3902: Make first user created via reverse proxy an admin by deluan · Pull Request #3920 · navidrome/navidrome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix #3902: Make first user created via reverse proxy an admin #3920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2025

Conversation

deluan
Copy link
Member
@deluan deluan commented Apr 2, 2025

Issue

Fixes #3902 - When Navidrome is accessed for the first time through a reverse proxy with authentication headers (Remote-User), it creates a regular non-admin user. This prevents the normal "first user is admin" flow, leaving the system without an admin user.

Changes

  • Modified the handleLoginFromHeaders function in server/auth.go to check if there are any existing users before creating a new user
  • If there are no existing users, the first user created via reverse proxy is now made an admin
  • Added unit tests to verify this behavior

Testing

Added new test cases to verify:

  1. The first user created via reverse proxy is made an admin
  2. Subsequent users created via reverse proxy are not made admins

This change maintains consistent behavior with manual user creation where the first user is always an admin.

…roxy

Fix #3902

Signed-off-by: Deluan <deluan@navidrome.org>
@deluan deluan merged commit f9081bb into master Apr 5, 2025
34 checks passed
@deluan deluan deleted the fix-first-admin-reverse-proxy branch April 5, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: admin cannot be created on fresh install accessed only by authenticating reverse proxy
1 participant
0