Skip to content

fix(runtime): mount set-initial-password on per-environment auth-proxy (#1544)#1562

Merged
hotlong merged 1 commit into
mainfrom
fix/runtime-set-initial-password
Jun 3, 2026
Merged

fix(runtime): mount set-initial-password on per-environment auth-proxy (#1544)#1562
hotlong merged 1 commit into
mainfrom
fix/runtime-set-initial-password

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

Closes #1544.

After SSO-as-owner, the env auth-proxy redirects a credential-less user to ?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) → 404 dead-end (confirmed on staging: POST set-initial-password → 404 while get-session → 200).

This adds a set-initial-password handler to the runtime AuthProxyPlugin (alongside sso-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, then internalAdapter.createAccount({ providerId: 'credential', password: hash }).

Verified: @objectstack/runtime builds clean (22/22).

🤖 Generated with Claude Code

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 3, 2026 7:45am

Request Review

@github-actions github-actions Bot added the size/s label Jun 3, 2026
@hotlong hotlong merged commit 94f0466 into main Jun 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-environment runtime: POST /api/v1/auth/set-initial-password → 404 (recovery flow dead-ends)

3 participants