Skip to content

fix(dashboard-auth): catch NotImplementedError in auth_login for password-only providers - #57445

Closed
benskls wants to merge 1 commit into
NousResearch:mainfrom
benskls:fix/basic-auth-not-implemented-redirect
Closed

fix(dashboard-auth): catch NotImplementedError in auth_login for password-only providers#57445
benskls wants to merge 1 commit into
NousResearch:mainfrom
benskls:fix/basic-auth-not-implemented-redirect

Conversation

@benskls

@benskls benskls commented Jul 3, 2026

Copy link
Copy Markdown

Problem

When only dashboard.basic_auth is configured (no OAuth provider), navigating to GET /auth/login?provider=basic crashes with an HTTP 500 — no error page, no redirect, just "Internal Server Error".

The root cause: BasicAuthProvider.start_login() intentionally raises NotImplementedError because password-only providers have no OAuth redirect flow. The auth_login route catches ProviderError but not NotImplementedError.

This is reproducible from any mobile browser that bookmarks or auto-completes the /auth/login?provider=basic URL, or when the auth gate lands on a password-only setup.

Fix

Catch NotImplementedError in auth_login() and redirect to the server-rendered /login page, which correctly renders the password form for providers with supports_password=True. The next= parameter is preserved through the redirect.

Steps to reproduce

  1. Configure only dashboard.basic_auth in config.yaml (no OAuth)
  2. Start dashboard: hermes dashboard --host 0.0.0.0 --port 9119
  3. From a remote browser (not localhost), navigate to http://<ip>:9119/auth/login?provider=basic
  4. Before: HTTP 500, "Internal Server Error"
  5. After: 302 redirect to /login -> password form renders correctly

Testing

Verified locally with:

  • curl -s -o /dev/null -w "%{http_code}" http://localhost:9119/auth/login?provider=basic -> 302 (was 500)
  • curl -s -o /dev/null -w "%{redirect_url}" "http://localhost:9119/auth/login?provider=basic&next=/projects" -> /login?next=%2Fprojects (next= preserved)
  • Full login flow from iPhone (Safari/Arc Search) via Tailscale -> works

…word-only providers

BasicAuthProvider.start_login() raises NotImplementedError because it
does not support OAuth redirect flows. When GET /auth/login?provider=basic
is reached (e.g. by a browser bookmark, a redirect, or the auth gate
landing on a password-only setup), the unhandled exception produces an
HTTP 500 with no useful message.

Catch NotImplementedError and redirect to the server-rendered /login
page instead, which renders the password form for providers that declare
supports_password=True.  The next= parameter is preserved through the
redirect so the user lands where they originally intended.

Fixes the root cause of dashboard inaccessibility from mobile browsers
when only basic_auth is configured.
@alt-glitch alt-glitch added type/bug Something isn't working comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/auth Authentication, OAuth, credential pools P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jul 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #55993 — same code site (auth_login() in hermes_cli/dashboard_auth/routes.py) and same mechanism: catch NotImplementedError from a password-only BasicAuthProvider.start_login() and 302-redirect to the server-rendered /login form. #55993 (opened 2026-07-01) is the earliest open PR with this approach; this one adds only a minor next= transport delta. Distinct from the route-level pre-guard #56666 and the middleware auto-SSO fix cluster (#54887/#57402), which take different mechanisms — related, not duplicates. Anchor issue: #55130.

@benskls

benskls commented Jul 3, 2026

Copy link
Copy Markdown
Author

Closing as duplicate of #55993. Added a suggestion for URL query preservation on the original PR.

@benskls benskls closed this Jul 3, 2026
@benskls
benskls deleted the fix/basic-auth-not-implemented-redirect branch July 3, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/dashboard Web dashboard / control panel UI (dashboard/, landing) duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants