fix(dashboard): skip auto-SSO for password-only providers (BasicAuthProvider) - #60123
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(dashboard): skip auto-SSO for password-only providers (BasicAuthProvider)#60123liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
Collaborator
Duplicate of #54887 — the earliest-open canonical fix. This adds the byte-identical |
Contributor
Author
|
Closing this PR as it duplicates the earlier-open #54887, which implements the same fix (checking |
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.
What does this PR do?
Fixes HTTP 500 error when accessing the dashboard root path (
/) when only a password-only auth provider (BasicAuthProvider) is configured.When
--host 0.0.0.0is set and onlyBasicAuthProvideris registered (no OAuth providers), unauthenticated access to/returns HTTP 500 instead of redirecting to the login page. The/logininterstitial itself works correctly — only the root-path auto-redirect is broken.The auth middleware's
_auto_sso_response()function attempts to auto-initiate OAuth redirect when exactly one session provider is registered. For password-only providers likeBasicAuthProvider, this redirects to/auth/login?provider=basic, which callsprovider.start_login(). However,BasicAuthProvider.start_login()raisesNotImplementedErrorbecause password authentication doesn't use OAuth flows, causing FastAPI to return a 500 error.The fix adds a guard in
_auto_sso_response()to skip auto-SSO for password-only providers. It checks if the provider hassupports_password = Trueand falls through to the/logininterstitial (which correctly renders the password form) instead of attempting OAuth redirect.Related Issue
Fixes #60105
Type of Change
Changes Made
hermes_cli/dashboard_auth/middleware.py: Added guard in_auto_sso_response()to skip auto-SSO redirect for password-only providers (detected bysupports_passwordattribute). Updated docstring to document this condition.tests/hermes_cli/test_dashboard_auth_middleware.py: Addedtest_password_only_provider_no_auto_sso()to verify that when onlyBasicAuthProvideris registered, requests to/redirect to/login(password form interstitial) instead of/auth/login(OAuth flow).How to Test
--host 0.0.0.0http://localhost:8080/in a browser without authentication/loginand displays the password login form (username + password fields). No HTTP 500 error.Automated test:
pytest tests/hermes_cli/test_dashboard_auth_middleware.py::test_password_only_provider_no_auto_sso -xvspasses.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs