Skip to content

fix(dashboard-auth): BasicAuthProvider 500 on /auth/login and auto-SSO redirect - #65013

Closed
wen0531 wants to merge 1 commit into
NousResearch:mainfrom
wen0531:fix/basic-auth-provider-500
Closed

fix(dashboard-auth): BasicAuthProvider 500 on /auth/login and auto-SSO redirect#65013
wen0531 wants to merge 1 commit into
NousResearch:mainfrom
wen0531:fix/basic-auth-provider-500

Conversation

@wen0531

@wen0531 wen0531 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Two bugs prevent BasicAuthProvider (username/password dashboard auth) from working on a non-loopback bind (0.0.0.0):

Bug 1: Auto-SSO redirect crashes on password providers

_auto_sso_response in middleware.py checks if there's exactly one session provider, and if so, auto-redirects to /auth/login?provider=N. But BasicAuthProvider.start_login() raises NotImplementedError because it's a password-only provider with no OAuth redirect flow. Result: HTTP 500 on first page load.

Bug 2: /auth/login endpoint crashes on password providers

The /auth/login?provider=basic route calls p.start_login() unconditionally. For password-only providers this also raises NotImplementedError → 500.

Fix

Both fixes add a supports_password check before the OAuth-specific code path:

  1. middleware.py: Skip auto-SSO redirect for password providers, fall through to /login which renders the password form.
  2. routes.py: Redirect password providers to /login instead of calling start_login().

OAuth providers are completely unaffected — the checks only gate on supports_password=True.

Verification

  • All 85 existing dashboard-auth tests pass
  • Manual testing with BasicAuthProvider on 0.0.0.0 bind confirms:
    • / → redirect to /login → 200 (was 500)
    • /auth/login?provider=basic → redirect to /login → 200 (was 500)
    • POST /auth/password-login → 200 with session cookies set

…O redirect

Two bugs prevented BasicAuthProvider (username/password) from working
on a non-loopback bind:

1. middleware.py _auto_sso_response: when a single session provider
   is registered, it auto-redirects to /auth/login?provider=N, which
   calls start_login(). BasicAuthProvider.start_login() raises
   NotImplementedError, returning HTTP 500. Fix: check supports_password
   and skip auto-SSO, falling through to /login which renders the
   password form.

2. routes.py auth_login: the /auth/login?provider=basic endpoint calls
   p.start_login() unconditionally. For password-only providers this
   raises NotImplementedError -> 500. Fix: when supports_password is
   True, redirect to /login instead of calling start_login().

Both fixes only add a supports_password check before the OAuth-specific
code path; OAuth providers are completely unaffected.
@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 15, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #58044 — same both-site supports_password guard (skip auto-SSO in middleware.py + route password providers to /login in routes.py) fixing the HTTP 500 when a sole password-only BasicAuthProvider is configured. #58044 is the earliest open PR with this exact two-site scope. Note: the earlier single-site fix #57214 (middleware-only) is a subset and is related. The prior anchors (#56886, #54887, issue #55130) have since been closed. A maintainer should pick one from this saturated cluster.

@wen0531

wen0531 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the triage! I see #58044 covers the same two-site fix and was filed earlier. Happy to close this in favor of #58044 if that's the one you pick — just let me know. Either way, glad the bug gets fixed.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Looks Good

  • Fix(dashboard-auth): BasicAuthProvider 500 on /auth/login and auto-SSO redirect
  • 16 additions, 3 deletions — targeted fix
  • No issues detected

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused report and implementation. This is already implemented on current main; automated hermes-sweeper review found the PR redundant.

  • Commit 3e24b16f566045399012bc1185fe0cdb6e1a1be9 (fix(dashboard): support mobile OAuth login) added the same two guards.
  • hermes_cli/dashboard_auth/middleware.py:212 skips auto-SSO for supports_password providers.
  • hermes_cli/dashboard_auth/routes.py:195-202 redirects password providers from /auth/login to /login before start_login().
  • tests/hermes_cli/test_dashboard_auth_password_login.py:201-217 already covers both redirect paths.

This also resolves the duplicate cluster noted in the prior triage discussion.

@teknium1 teknium1 closed this Jul 16, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 16, 2026
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 sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants