fix(dashboard-auth): don't auto-redirect to OAuth when sole provider is password-only - #58044
Closed
laserguidedcake wants to merge 1 commit into
Closed
Conversation
…is password-only When a dashboard is configured with only a password-based auth provider (e.g., BasicAuthProvider) and binds to a non-loopback host, the gated-auth middleware's auto-SSO redirect would unconditionally call provider.start_login(), which raises NotImplementedError. This produced an unhandled 500 Internal Server Error on every unauthenticated request, making the dashboard completely unusable in basic-auth-only self-hosted mode. The fix has two parts: 1. In _auto_sso_response(): skip auto-redirect when the sole session provider has supports_password=True (no OAuth redirect flow). 2. In auth_login(): catch NotImplementedError from start_login() and return 400 with the provider's message instead of crashing. Added regression test: test_password_only_provider_prevents_auto_oauth_redirect_and_gates_login Closes: NousResearch#57410 Reported-by: NullTerminal
Collaborator
Duplicate of #54887 — same |
This was referenced Jul 5, 2026
13 tasks
This was referenced Jul 8, 2026
Contributor
|
Thanks for the focused reproduction and regression coverage. This has already been implemented on current
|
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.
Bug Report: Dashboard 500 crash when only password-based auth provider is configured
Summary
When a self-hosted Hermes dashboard is configured with only a password-based authentication provider (e.g.
BasicAuthProvider) and bound to a non-loopback host, every unauthenticated request produces a500 Internal Server Error. The dashboard becomes completely unusable because the auth gate's auto-SSO redirect unconditionally callsstart_login()on a provider that does not implement OAuth redirect flow.Environment
--host 0.0.0.0 --port 9119(non-loopback, auth gate engaged)["basic"](only one, password-only)Steps to Reproduce
BasicAuthProvider:http://your-host:9119/Expected Behavior
/loginActual Behavior
NotImplementedError:Root Cause
Two places in the auth gate call
provider.start_login()without checking if the provider actually supports OAuth redirect:hermes_cli/dashboard_auth/middleware.py:_auto_sso_response()supports_session=Trueprovider is registered, the middleware auto-redirects to/auth/login?provider=<name>to silently initiate OAuth.supports_password=True, nostart_login()implementation), the redirect hits/auth/login, which callsstart_login()→NotImplementedError.hermes_cli/dashboard_auth/routes.py:auth_login()auth_loginroute callsprovider.start_login()inside atry/except ProviderErrorblock.NotImplementedErroris not caught, so it bubbles up as an unhandled exception → HTTP 500.Fix
Patch 1: Skip auto-redirect for password-only providers
File:
hermes_cli/dashboard_auth/middleware.pyPatch 2: Defensive catch in auth_login route
File:
hermes_cli/dashboard_auth/routes.pyRegression Test
Added new test:
test_password_only_provider_prevents_auto_oauth_redirect_and_gates_login/302-redirects to/login(not/auth/login?provider=...)/logininterstitial renders correctly (200 + password form)/auth/login?provider=basic-likereturns 400 (not 500)Test result: 34/34 tests in
test_dashboard_auth_middleware.pypass, including the new regression test.Full Branch with Fix + Test
Branch contains 3 files changed, 62 insertions(+), 1 deletion(-):
hermes_cli/dashboard_auth/middleware.pyhermes_cli/dashboard_auth/routes.pytests/hermes_cli/test_dashboard_auth_middleware.pySuggested Commit Message