fix(dashboard): skip auto-SSO redirect for password-only providers (#55130) - #55235
Closed
liuhao1024 wants to merge 1 commit into
Closed
Conversation
When the sole registered auth provider has supports_password=True (e.g. BasicAuthProvider), the auto-SSO shortcut in _auto_sso_response() would redirect to /auth/login which calls start_login() — a method that password-only providers don't implement. This caused HTTP 500 on every unauthenticated page load. Add a supports_password check before the redirect so password-only providers fall through to the /login interstitial (the password form). Fixes NousResearch#55130
Collaborator
Duplicate of #54887 — same |
Contributor
Author
This was referenced Jun 30, 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.
What does this PR do?
Fixes HTTP 500 on every unauthenticated dashboard page load when the only registered auth provider is the built-in
basic(username/password) provider.The
_auto_sso_response()shortcut in the auth middleware unconditionally redirects to/auth/login?provider=<name>when exactly one provider is registered. That route callsprovider.start_login(), whichBasicAuthProviderdoesn't implement (it's password-only, not OAuth). The resultingNotImplementedErrorbubbles up as an unhandled 500.The fix adds a
supports_passwordguard: when the sole provider is password-based, auto-SSO is skipped and the request falls through to the/logininterstitial (the password form), which already works correctly.Related Issue
Fixes #55130
Type of Change
Changes Made
hermes_cli/dashboard_auth/middleware.py— Addgetattr(provider, "supports_password", False)check in_auto_sso_response()to skip auto-SSO for password-only providers (3 lines + comment)tests/hermes_cli/test_dashboard_auth_middleware.py— Add regression testtest_auto_sso_skips_password_only_providerthat registers aBasicAuthProvideras the sole provider and verifies/redirects to/login(password form) instead of/auth/login(OAuth initiation)How to Test
HERMES_DASHBOARD_BASIC_AUTH_USERNAMEandHERMES_DASHBOARD_BASIC_AUTH_PASSWORDenvironment variableshermes dashboard --host 0.0.0.0with no other auth providers configured/in a browser without a session cookie/loginshowing the username/password form; login works normallypytest tests/hermes_cli/test_dashboard_auth_middleware.py -v— all 34 tests pass (including the new regression test)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/A