fix(dashboard): handle NotImplementedError on logout for password-only providers (#55985) - #55993
Conversation
…y providers BasicAuthProvider.start_login() raises NotImplementedError because it is password-only and has no OAuth redirect flow. The auth_login route only caught ProviderError, so the NotImplementedError propagated through the ASGI stack, crashing the dashboard server (exit 0) and triggering a container restart loop with restart: unless-stopped. Catch NotImplementedError separately and redirect to the login form page (/login) instead of crashing. This preserves the 'next' parameter via cookie so the user lands on the right page after re-authenticating. Fixes NousResearch#55985
Related: competes with #55988 for the same issue #55985. Both fix the |
|
Nice fix! I hit the same bug independently and opened #57445 before finding yours. One improvement suggestion: your fix preserves except NotImplementedError:
from urllib.parse import quote
next_path = request.query_params.get("next", "")
safe = _validate_post_login_target(next_path)
target = f"/login?next={quote(safe, safe='')}" if safe else "/login"
return RedirectResponse(url=target, status_code=302)This way the login page can read Closing #57445 as duplicate. |
|
Thanks for the focused dashboard-auth fix. Automated hermes-sweeper review found that current
Closing as implemented on main; no contributor action is needed. |
Summary
Prevent dashboard crash when logging out with a password-only auth provider (BasicAuthProvider).
Problem
BasicAuthProvider.start_login()raisesNotImplementedErrorbecause it has no OAuth redirect flow — it is password-only. Theauth_loginroute (/auth/login) only catchesProviderError, so theNotImplementedErrorpropagates through the ASGI stack, crashing the dashboard server (exit 0). Withrestart: unless-stopped, the container enters a restart loop.The logout flow triggers this because it redirects to
/auth/login?provider=basic, which unconditionally callsp.start_login().Fix
Catch
NotImplementedErrorseparately inauth_loginand redirect to the login form page (/login) instead of crashing. Thenextparameter is preserved via cookie so the user lands on the right page after re-authenticating.Reproduction
restart: unless-stoppedNotImplementedError: BasicAuthProvider is password-onlyFixes #55985