fix(runtime): mount set-initial-password on per-environment auth-proxy (#1544)#1562
Merged
Conversation
…proxy (#1544) After SSO-as-owner, the env auth-proxy redirects a credential-less user to /_console/system/profile?recovery_needed=true to "Set a local password", but that form POSTs /api/v1/auth/set-initial-password — a route only the full AuthPlugin registers. AuthPlugin is skipped on per-environment runtimes, so the request fell through to better-auth (no such route) and 404'd — a dead-end. Add a set-initial-password handler to the runtime auth-proxy (next to sso-exchange), mirroring AuthPlugin's logic against the environment's own auth context: require a valid env session, reject if a credential password already exists (409 → use change-password), enforce min/max length, then internalAdapter.createAccount({ providerId: 'credential', password: hash }). Closes #1544. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1544.
After SSO-as-owner, the env auth-proxy redirects a credential-less user to
?recovery_needed=trueto Set a local password — but that form POSTs/api/v1/auth/set-initial-password, a route only the full AuthPlugin registers. AuthPlugin is skipped on per-environment runtimes, so the request fell through to better-auth (no such route) → 404 dead-end (confirmed on staging:POST set-initial-password → 404whileget-session → 200).This adds a
set-initial-passwordhandler to the runtimeAuthProxyPlugin(alongsidesso-exchange), mirroring AuthPlugin's logic against the environment's own auth context: require a valid env session (401 else), reject if a credential password already exists (409 → use change-password), enforce min/max length, theninternalAdapter.createAccount({ providerId: 'credential', password: hash }).Verified:
@objectstack/runtimebuilds clean (22/22).🤖 Generated with Claude Code