fix(dashboard-auth): skip OAuth redirect for password-only providers in auto-SSO - #57402
Closed
cliffsch wants to merge 1 commit into
Closed
fix(dashboard-auth): skip OAuth redirect for password-only providers in auto-SSO#57402cliffsch wants to merge 1 commit into
cliffsch wants to merge 1 commit into
Conversation
…in auto-SSO The _auto_sso_response middleware redirects unauthenticated requests to /auth/login?provider=<name> when exactly one session provider is registered. This works for OAuth providers but raises NotImplementedError for password-only providers (e.g. basic auth), whose start_login() is a stub — the login page POSTs to /auth/password-login instead. Add a check: when the single provider has supports_password=True, return None so the request falls through to the server-rendered /login page (which renders the credential form). Without this fix, accessing the dashboard via a non-loopback address (e.g. Tailscale IP) with only basic auth configured results in a 500 error on every page load.
Collaborator
Duplicate of #54887 (earliest open canonical fix) — byte-for-byte the same |
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
_auto_sso_responsemiddleware redirects unauthenticated requests to/auth/login?provider=<name>when exactly one session provider is registered. This works for OAuth providers but raisesNotImplementedErrorfor password-only providers (e.g. basic auth).When basic auth is the only configured provider and the dashboard is accessed via a non-loopback address (e.g. Tailscale IP, LAN IP), every page load results in a 500 error:
Access via loopback (e.g.
http://localhost:9119) works because loopback connections bypass auth entirely viashould_require_auth().Root cause
_auto_sso_responsecheckslen(providers) == 1but doesn't verify the provider supports OAuth before redirecting to/auth/login. For password-only providers,start_login()is a stub that raisesNotImplementedError— the correct endpoint is/auth/password-login(POST), and the login page renders a credential form.Fix
Add a check: when the single session provider has
supports_password=True, returnNoneso the request falls through to the server-rendered/loginpage, which renders the credential form for password-only providers.Testing