Skip to content

fix(dashboard-auth): skip auto-SSO redirect for password-only providers - #57319

Closed
karlesnine wants to merge 1 commit into
NousResearch:mainfrom
karlesnine:fix/auto-sso-password-provider
Closed

fix(dashboard-auth): skip auto-SSO redirect for password-only providers#57319
karlesnine wants to merge 1 commit into
NousResearch:mainfrom
karlesnine:fix/auto-sso-password-provider

Conversation

@karlesnine

Copy link
Copy Markdown

What does this PR do?

Fix an Internal Server Error (500) when accessing an auth-gated dashboard that uses basic_auth as its sole authentication provider.

The auto-SSO middleware redirects unauthenticated HTML loads to /auth/login?provider=basic — the OAuth initiation route. But basic auth doesn't support OAuth; start_login() raises NotImplementedError. The fix skips the auto-redirect for password-only providers so the /login page renders the password form (POST to /auth/password-login) instead.

Related Issue

Fixes a crash when dashboard.basic_auth.password is configured and the dashboard is bound to a non-loopback host (e.g. --host 0.0.0.0).

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • hermes_cli/dashboard_auth/middleware.py — skip auto-SSO redirect when the sole provider has supports_password = True
  • tests/hermes_cli/test_dashboard_auth_401_reauth.py — add test_password_provider_skips_auto_sso

How to Test

  1. Configure dashboard.basic_auth.password in config.yaml
  2. Start dashboard with hermes dashboard --host 0.0.0.0 --port 9119
  3. Access http://<host>:9119 without session cookie
  4. Before fix: 500 Internal Server Error
  5. After fix: /login page renders with username/password form

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 24.04 (LTS) + macOS 15.x

Documentation & Housekeeping

  • I've considered cross-platform impact (Windows, macOS) — N/A, auth middleware is platform-agnostic

The auto-SSO middleware (_auto_sso_response) redirects an unauthenticated
HTML load to /auth/login?provider=... when exactly one interactive provider
is registered. For password-only providers (basic auth) this 302s to the
OAuth initiation route, whose start_login() raises NotImplementedError —
basic auth has no OAuth redirect flow, only /auth/password-login.

Fix: check provider.supports_password before auto-redirecting. Password-only
providers fall through to the /login interstitial, which renders the
password form (POSTing to /auth/password-login).

Test: verify that a password-only StubAuthProvider skips the auto-SSO
redirect and lands on /login instead of /auth/login.

Fixes the Internal Server Error when accessing an auth-gated dashboard
that uses basic_auth as its sole authentication provider.

Co-authored-by: karlesnine <karles@karlesnine.com>
@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 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #54887 (earliest open canonical fix) — same supports_password guard in _auto_sso_response() (hermes_cli/dashboard_auth/middleware.py) so a sole password-only BasicAuthProvider falls through to /login instead of 500ing on start_login(). This is the 9th+ identical PR in the dashboard-auth auto-SSO cluster (siblings: #54958, #56627). Flagging the cluster size for maintainer attention.

@karlesnine

Copy link
Copy Markdown
Author

If 8 other PRs address the same issue, I'll close this one myself.

@karlesnine karlesnine closed this Jul 3, 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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants