Repository navigation
fix(platform): treat a provisioned account as a verified account - #3408
Merged
Merged
Conversation
Tale sends no mail and creates no account on its own, so an address could never become verified by any action a person or an admin can take: the setup wizard's owner and every colleague added under Settings > Members started unverified and stayed that way. Only enterprise SSO, SCIM, trusted headers or the CLI's operator attestation ever set the flag. Everything that requires a vouched-for address therefore refused them — the OIDC email_verified claim a relying party reads (identity issuance answers 403 IDENTITY_NOT_ELIGIBLE, after the login page has already sent the person back to the application), conversation synchronization and the notification mirror. The break-glass administrator the deploy creates had to set the flag itself to work around it. Whoever provisions an account names its address, and on this platform that assertion is the only verification there can be - the same one the CLI records as operator-attested. Every account Better Auth creates here now arrives verified; a directory-provisioned account is written straight to the table and keeps its provider's verdict. Accounts provisioned before the rule are caught up at boot, after Better Auth's own migrations, by the one statement that can tell them apart: a credential row means this instance issued the password. It is not a numbered migration because the app's SQL runs before those tables exist and does not own them, and it runs on every boot so a rolling deploy heals itself. Proven against real Postgres: the members door's account is verified, the boot catch-up flips an account provisioned earlier and leaves a directory account alone.
The provider signs the login and consent continuation with the same lifetime it gives an authorization code, so codeExpiresIn was also the window a person had to sign in at Tale after an application sent them here. At sixty seconds, anyone who had to look up a password or reach for a second factor came back to a refused request and the provider's error page; starting over from the application was the only way on, and whether it worked depended on how fast they typed. Five minutes is the conventional ceiling for a single-use, PKCE-bound code and leaves room for a password manager and an authenticator. The CLI pins the backend's provider policy before it provisions a managed client, so its expectation moves with it — a deployment needs a CLI at least as new as the platform it deploys, which the managed bundle already requires.
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.
Why
Tale sends no mail and has no self-service sign-up, so an address could never become verified by anything a person or an admin can do. The setup wizard's owner and every colleague added under Settings > Members started unverified and stayed that way; only enterprise SSO, SCIM, trusted headers or the CLI's
operator-attesteddeclaration ever set the flag.Everything that requires a vouched-for address therefore refused those people:
Found from the consuming side: staff on a VAT plus deployment could not use "Continue with Tale" at all. The break-glass administrator added in #3406 already had to set
emailVerifieditself to work around the same gap.What changes
A provisioned account is a verified account. Whoever provisions an account names its address, and on this platform that assertion is the only verification there can be — the same one the CLI records as
operator-attested. Every account Better Auth creates here now arrives verified (setup wizard owner, members door, the deploy's own accounts). A directory-provisioned account is written straight to the table and keeps its provider's verdict.Existing deployments heal themselves. After Better Auth's own migrations, boot catches up accounts this instance provisioned — a
credentialrow is the proof that it issued the password. Not a numbered migration: the app's.sqlfiles run before those tables exist and do not own them. It runs on every boot, so a rolling deploy cannot leave an account behind.Five minutes to sign in. The provider signs the login and consent continuation with the same lifetime it gives an authorization code, so
codeExpiresIn: 60was also the window a person had to find a password and answer a second factor before the request expired and the provider's error page took over. It is now 300 — still a single-use, PKCE-bound code, within the conventional ceiling.Deployment note
The CLI pins the backend's provider policy before it provisions a managed client, so its
codeExpiresInexpectation moves with the platform in this PR. A deploy therefore needs a CLI at least as new as the platform it deploys, which the managed bundle already requires.Proof
bun run --filter @tale/platform test— 76,011 pass; the new unit tests fail without each fix.backend/integration-check.ts).bun run --filter @tale/cli testmatches the baseline exactly.AUTH-F19with its automation-register row.