fix(dashboard): guard auth_login against password-only providers to prevent NotImplementedError crash - #55988
Closed
liuhao1024 wants to merge 1 commit into
Conversation
…revent NotImplementedError crash BasicAuthProvider.start_login() raises NotImplementedError because it is password-only. The auth_login route called start_login() unconditionally, only catching ProviderError. Navigating to /auth/login?provider=basic crashed the ASGI server, causing the container to enter a restart loop. Add a supports_password guard that returns HTTP 400 before attempting the OAuth redirect flow for password-only providers. Regression test: test_login_password_only_provider_returns_400_not_500.
Collaborator
Related: this fixes the same |
13 tasks
13 tasks
This was referenced Jul 2, 2026
Contributor
|
Thanks for identifying the direct
|
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 a crash in the dashboard auth login route when a password-only provider (BasicAuthProvider) is accessed via
/auth/login?provider=basic. The route unconditionally callsp.start_login()which raisesNotImplementedErrorfor password-only providers, crashing the ASGI server and causing the container to enter a restart loop.The fix adds a guard that rejects password-only providers with a 400 response before attempting the OAuth redirect flow.
Related Issue
Fixes #55985
Type of Change
Changes Made
hermes_cli/dashboard_auth/routes.py: Added asupports_passwordguard inauth_login()that returns HTTP 400 for password-only providers, preventing the unhandledNotImplementedErrorfrom reaching the ASGI top level.tests/hermes_cli/test_dashboard_auth_middleware.py: Addedtest_login_password_only_provider_returns_400_not_500regression test that registers a BasicAuthProvider and verifies/auth/login?provider=basicreturns 400 with a descriptive error message.How to Test
python -m pytest tests/hermes_cli/test_dashboard_auth_middleware.py -v— all 34 tests should pass, including the newtest_login_password_only_provider_returns_400_not_500./auth/login?provider=basic— should return 400 JSON error instead of 500 crash.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