fix(dashboard): don't auto-SSO password-only providers into the OAuth route - #57927
Closed
jconover wants to merge 1 commit into
Closed
fix(dashboard): don't auto-SSO password-only providers into the OAuth route#57927jconover wants to merge 1 commit into
jconover wants to merge 1 commit into
Conversation
_auto_sso_response redirects an unauthenticated HTML load straight to /auth/login when exactly one interactive provider is registered. That route runs the OAuth authorization-code flow (provider.start_login). A password-only provider (e.g. BasicAuthProvider) has no OAuth redirect flow — its start_login raises NotImplementedError — so a single-provider BasicAuth dashboard 500s on every unauthenticated document load instead of rendering the /login password form. Guard the auto-SSO shortcut on the provider actually supporting the OAuth redirect: when the sole provider is password-based (supports_password), fall through to /login so the credential form renders. OAuth providers are unaffected. Add a regression test asserting a single password-only provider yields a 302 to /login (not /auth/login).
Collaborator
Duplicate of #54887 — this adds the same |
3 tasks
This was referenced Jul 4, 2026
Contributor
|
Thanks for the focused regression report and test coverage. This is an automated hermes-sweeper review; the requested behavior is already present on current
The earlier duplicate-cluster note is consistent with this result; this PR is now redundant. |
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.
Summary
A dashboard configured with only basic (username/password) auth returns HTTP 500 on every unauthenticated page load instead of showing the login form.
Root cause
_auto_sso_responseinhermes_cli/dashboard_auth/middleware.pyis an OAuth-only optimization: when exactly one interactive provider is registered, it skips the/loginchooser and 302-redirects the browser straight to/auth/login?provider=…. That route runs the OAuth authorization-code flow viaprovider.start_login().A password-only provider (
BasicAuthProvider,supports_password = True) has no OAuth redirect flow — itsstart_loginraises:So a single-provider BasicAuth dashboard 500s on every unauthenticated document load. It's masked on loopback (already-authenticated sessions), but surfaces immediately when the dashboard is exposed and hit fresh (e.g. bound to a LAN address).
Fix
Guard the auto-SSO shortcut on the sole provider actually supporting the OAuth redirect. When it's password-based, return
Noneso the gate falls through to the/loginpassword form. OAuth providers are unaffected.Test Plan
test_single_password_provider_renders_login_not_oauthtoTestAutoSsoRedirect: a single password-only provider must 302 to/login, never/auth/login.fastapi.testclient.TestClientagainst the real app:302 /login?next=%2Fsessions✅ (was 500)302 /auth/login?provider=stub&next=%2Fsessions✅ (unchanged)TestAutoSsoRedirectcases (OAuth auto-redirect, loop guard, multi-provider chooser, API-path 401) preserved.Notes
Minimal footprint: one guard line in the middleware + one regression test. No new config, no schema change, no impact on the OAuth path.