Skip to content

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

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-58921-basic-auth-sso-crash
Closed

fix(dashboard): skip auto-SSO redirect for password-only providers#58926
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-58921-basic-auth-sso-crash

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes an HTTP 500 crash when BasicAuthProvider (password-only) is the sole registered auth provider. The auto-SSO optimization in _auto_sso_response() unconditionally redirects to /auth/login, which calls start_login() — but password-only providers raise NotImplementedError there, crashing the request.

The fix adds a guard: if the single provider has supports_password=True, auto-SSO falls through to the /login interstitial that already renders a credential form.

Related Issue

Fixes #58921

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • hermes_cli/dashboard_auth/middleware.py — add supports_password guard in _auto_sso_response() before constructing the /auth/login redirect URL (9 lines added)
  • tests/hermes_cli/test_dashboard_auth_401_reauth.py — add test_password_only_provider_skips_auto_sso that registers a password-only stub provider and asserts the gate falls through to /login instead of redirecting to /auth/login (31 lines added)

How to Test

  1. Run pytest tests/hermes_cli/test_dashboard_auth_401_reauth.py::TestAutoSsoRedirect -xvs — all 6 tests should pass, including the new test_password_only_provider_skips_auto_sso.
  2. Run pytest tests/hermes_cli/test_dashboard_auth_401_reauth.py -q — all 45 tests should pass (no regressions).
  3. Manual: configure hermes dashboard with only BasicAuthProvider, open the URL unauthenticated → should see the login form (not HTTP 500).

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):)
  • 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
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation — or N/A
  • I've updated cli-config.yaml.example — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — or N/A
  • I've considered cross-platform impact — or N/A
  • I've updated tool descriptions/schemas — or N/A

Screenshots / Logs

N/A

When BasicAuthProvider is the only registered auth provider, the
auto-SSO optimization in _auto_sso_response() redirects to
/auth/login, which calls start_login() — raising NotImplementedError
and producing HTTP 500.

Add a guard: if the sole provider has supports_password=True, fall
through to the /login interstitial that renders a credential form.

Fixes NousResearch#58921
@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 5, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #54887 — same single-file supports_password guard in _auto_sso_response() (hermes_cli/dashboard_auth/middleware.py) that stops a sole password-only BasicAuthProvider from 500ing on auto-SSO redirect. #54887 is the earliest open canonical middleware-only fix in this cluster (regression from merged #54846). This is one of ~10 near-identical PRs for the same crash. Related: #58921 (the issue this targets). For a broader fix that also guards the route-level path in routes.py, see the both-facet supersets #58852/#58044/#58171.

@liuhao1024

Copy link
Copy Markdown
Contributor Author

Closing in favor of #54887 (sjfkai) — same supports_password guard in _auto_sso_response(), created 6 days earlier with maintainer LGTM.

This PR's regression test (test_password_only_provider_skips_auto_sso) may be worth adding to #54887 as a follow-up if the maintainer requests it.

@liuhao1024 liuhao1024 closed this Jul 5, 2026

@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

Well-scoped refactor removing unused imports from multiple files. Removes os import from codex_runtime.py, dataclasses.field from billing_view.py, and cleans up agent.conversation_loop.py. Good maintenance.


Reviewed by Hermes Agent

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.

500 Internal Server Error when BasicAuthProvider is the only auth provider (auto-SSO crashes on password-only provider)

3 participants