Repository navigation
fix(plugin-auth)!: accepting, declining and listing an invitation need a verified email address on every deployment - #34883
Conversation
…ified email address Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…rified email address at every door Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…ing need a verified address; the Console answers the refusal with its verify-email state Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…ips in Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
# Conflicts: # content/docs/deployment/self-hosting.mdx # packages/plugins/plugin-auth/src/auth-manager-organization-plugin.ts # ui/packages/app-shell/src/console/organizations/manage/AcceptInvitationPage.tsx
…d a verified address on every deployment; an invitation sign-up joins by accepting once verified Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…ocs and changeset state the verified-address rule Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 26 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f27946cc9e6f5de5c86e8722fbb7b176c221e8ed && git checkout f27946cc9e6f5de5c86e8722fbb7b176c221e8ed
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d576509c80575197b3218aeb1f55884e5ed06ea6 bf3bf857d6d24772ef81266b807544ac61df771f && git checkout -B drift-repro d576509c80575197b3218aeb1f55884e5ed06ea6 && git merge --no-ff bf3bf857d6d24772ef81266b807544ac61df771f
node scripts/docs-audit/affected-docs.mjs --json d576509c80575197b3218aeb1f55884e5ed06ea6
|
…quest that creates it, so no other creation of the address reads it Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…goes straight to the verification mail; release notes state one rule Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…the sign-up binding rule Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj The seat adopts the delta record below. It was rendered on this head, at the contract-review tier, by the same isolated reviewer that recorded the earlier FAIL. The seat holds that FAIL record privately; mechanism detail stays with the security seat. This record is also the seat's confirmation of the DELIBERATE CORRECTION, judged sentence by sentence below. Contract reviewServed-tier:
The full suites, type check, derived gates, dogfood and CI were not run by the reviewer. Scope: delta ① Derived judgmentsEarlier findings
DELIBERATE CORRECTION: The PR body's table matches the diff row for row.
Every sentence the note now carries is true at Also judged
Findings
② Semver levelUnchanged and correct:
The corrected note is non-breaking at ③ Boundary flags
④ Design judgmentThe request-scoped record is the right shape. It mirrors Implemented-by: VERDICT: PASS |
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under
skills/**teaches accepting an organization invitation or invitation sign-up;content/docs/deployment/self-hosting.mdxgains the rules in this change.ADR amendment: #34909, lands with this PR.
维护者速读
invite_only下凭邀请 id 注册的账号,邮箱验证前不加入组织,验证后接受邀请时按邀请的角色入组。控制台:接受、拒绝被拒,以及凭邀请链接注册后自动接受被拒,都直接转到验证邮件页。packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts(规则与两个 vendor 钩子);auth-manager-membership-admission.ts的settleMembership(未验证的邀请注册不绑定,按创建它的请求判断);packages/verify/src/harness.ts的signUp(测试夹具改走运营方通道)。pnpm --filter @objectstack/plugin-auth exec vitest run src/invitation-acceptance-verified-address.test.ts,预期 30 个用例全绿。DELIBERATE CORRECTION
This PR rewrites
.changeset/34272-accept-invitation-verified-email.md, the pending release note of #34666, which exists on the merge base. The rule this PR ships made that note's sentences about deployments without live mail, and about listing and declining, false; left as it was, the release would carry two contradictory BREAKING entries for one route.check-empty-changesetstays red on this file by design; it is not restored. The note is reduced to the parts that ship beside this PR's entry and points at that entry, which carries the BREAKING notice and the migration.adr-0087: not-required (no-migration-prescription))POST /api/v1/auth/organization/accept-invitation(@objectstack/plugin-auth), from a session whose address is unverified, while the email service answersisConfigured() === true, now answers403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION(better-auth's own code and sentence, the ones its accept route answers when its option is on) and writes nothing; the invitation stays pending. It used to answer200and write the membership. The vendor's not-found, expiry and recipient refusals still come first, so a session that is not the invitee learns nothing new. The check runs on the vendor'sbeforeAcceptInvitationhook, on the session user the vendor itself resolved (cookie or bearer token alike), and asks whether mail is live on every request."POST /api/v1/auth/organization/accept-invitation(@objectstack/plugin-auth) answers a session whose address is unverified with better-auth's own403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATIONand its sentence, the answer its accept route gives when its option is on, and writes nothing. The vendor's not-found, expiry and recipient refusals still come first, so a session that is not the invitee learns nothing new. The check runs on the vendor'sbeforeAcceptInvitationhook, on the session user the vendor itself resolved (cookie or bearer token alike)."get-invitation,list-user-invitationsandreject-invitation, which write no membership; the one-step door …; and a verified session everywhere. better-auth'srequireEmailVerificationOnInvitationstays declaredfalse: it governs reading and declining too, and is read once at boot."@objectstack/runtimelineWhat changes
The rule. Accepting, declining and listing an organization invitation need a verified email address, on every deployment, whatever the state of its mail transport. Reading one invitation by its id stays open, so the accept page can show it. A password account verifies through the verification mail; an account a social or SSO provider made counts only when the provider verified the address. The invitation's id, which its accept link and a copied link carry, is no proof of the mailbox, and no setting relaxes the rule.
packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts:refuseUnverifiedInvitationAnswer(user, { verificationRequired })refuses a user whose address is not verified with the vendor's own403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION(read off the plugin's$ERROR_CODES; the local fallback is pinned equal to it). It reads no mail state.auth-manager-organization-plugin.ts: the rule is asked from better-auth'sbeforeAcceptInvitationandbeforeRejectInvitation, which the vendor fires after its own not-found, expiry and recipient checks and before anything is written, with the session user its own verification check reads (cookie and bearer alike).requireEmailVerificationOnInvitationstays declaredfalse: the vendor's option governs accept, reject and get-invitation together, and get-invitation stays open.list-user-invitations-verification.ts: the host's rebuild ofGET /organization/list-user-invitationsrefuses a session whose address is not verified,403 EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION, unconditionally, so the inbox carries the rule itself whatever the declaration says. The listing itself stays the vendor's own query.invite_onlywithmembershipPolicy: 'auto', a sign-up admitted by the invitation it presents is not bound to the deployment's organization while its address is unverified (settleMembership,auth-manager-membership-admission.ts). The admission gate records the admission on the request that creates the account, and both settle seams of that creation read it there; no other creation of the same address, in any other request, can read it. It joins by accepting the invitation once verified, with the invitation's role, or through a platform administrator. Chosen as a policy-skip at creation rather than a bind at verification: the invitation is the instrument of admission under this posture and its acceptance already writes the membership; a role-less bind at verification would let a verified person who never accepted, or who declined, join by a route no issuer chose; and ADR-0093 D7 decides membership at creation, where a verification-time bind would add a decision point on every path that can writeemail_verified. A user row that cannot be read while that request admitted an invitation sign-up binds nothing. The first account, accounts an administrator creates, accounts a boot command provisions and a sign-up the invitation mail's proof verifies bind as before.@object-ui/app-shell): the accept page answers a refused decline with the verification-mail screen for the account's address, as it answers a refused accept; and a sign-up from an invitation link (useInvitationSignUpJoin) whose automatic accept is refused for an unverified address goes straight to that screen, whose link returns to the accept page, instead of passing through the accept page first. The Console has no caller of the listing route.operatorProvisioningFieldin plugin-auth'saudience-gate-test-support.ts(three suites),@objectstack/verify'ssignUp(which falls back to the invitation lane only when the auth service offers no operator door), and four@objectstack/runtimepin suites. Fixtures that answer an invitation mark the invitee verified first.content/docs/deployment/self-hosting.mdxstates the rule and its consequence: a deployment without a live mail transport cannot onboard a password account by invitation link; an invitee whose social or SSO provider verifies the address can still accept a copied link there; otherwise a platform administrator creates the account, or attaches an existing one with Add Member, which is open to platform administrators only and attaches existing accounts only.tenancy-modes.mdx,environment-variables.mdx,permissions/authentication.mdxandpermissions/sso.mdxstate the sign-up binding rule and that admission is not acceptance.docs/qa/platform-checklist/RUNNER.md's persona door 1 follows the rule.ui/.../invitationSignUpJoin.ts's header describes the flow.scripts/check-route-envelope.mjs: one comment sentence..changeset/invitation-acceptance-verified-address.md:@objectstack/plugin-auth,@objectstack/verify,@object-ui/app-shellpatch; BREAKING;adr-0087: not-required (no-migration-prescription).@object-ui/consoleis not listed: no file underui/apps/consolechanges, and the@object-ui/*and@objectstack/*packages version as one fixed group..changeset/34272-accept-invitation-verified-email.md: the DELIBERATE CORRECTION above.No spec, schema, stored row, route path, error code or exported signature of a published entry changes.
Tests
src/invitation-acceptance-verified-address.test.ts(realAuthManagerover@objectstack/driver-sqlon sqlite:memory:), 30 cases:src/invitation-accept-verified-email.test.ts: the vendor's own code; accept and decline refused for cookie and bearer sessions with nothing written; get-invitation open; the vendor's recipient refusal still answers first at both doors; verified controls; the one-step proof door; the function's pins.src/list-user-invitations-verification.test.ts: the listing refuses an unverified session while get-invitation answers; scope pins on a verified session; the rebuild's contract and the vendor pin.acceptInvitationVerifiedEmail-34272.test.tsx(a refused decline goes to the verification-mail screen, beside the accept case and its control);invitationSignUpJoin-30125.test.tsx(an unverified invitation sign-up goes straight to the verification-mail screen with its address and the accept page as the return).Acceptance notes
email_domainposture.AuthManager.isEmailDeliveryLiveis unchanged: its remaining readers (the existing-address sign-up answer, the invite's delivery outcome,features.emailDelivery, the visitor verification resend) back success claims, where an unreadable transport reading as not live is the honest direction. No invitation gate reads it.@objectstack/verify'ssignUpkeeps its invitation-lane helper as the fallback; the helper is also a control ofcheck:swallow-census-controls, which is why it stays.Verification
Head note: the PR head is
bf3bf857d6, a sync-only merge ofmainmade by the seat through the relay on top of5147ad6a3a. It has the same tree as a clean merge of the two, and the same net patch-id. The evidence below was taken at5147ad6a3aand carries.Final head
5147ad6a3a, the merge oforigin/mainafter the patch commits.CI at the final head
Every required context succeeded: Lint & Repo Gates, TypeScript Type Check (Type Check · workspace included), Test Core (all ten shards), Build Core, Governed Surface Queue Guard, Lint UI, Type Check UI, Test UI, Build & E2E UI, Live E2E UI and Dogfood Regression Gate. Check Changeset is red by design:
check-empty-changesetrefuses the rewrite of.changeset/34272-accept-invitation-verified-email.md, the DELIBERATE CORRECTION declared above.Derived gates: 134 of 134 run, every exit code recorded
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 134 families at5147ad6a3a. All 134 ran. 131 exited 0 on the first run.check:dual-build-cjs-loadsanswered exit 3 (prerequisite: some packages'distnot built) and exit 0 once built.pnpm --dir ui exec vitest run scripts/was killed for memory while other runs shared the box, and exited 0 run alone (Test Files 171 passed, 2 skipped).check-empty-changesetexits 1: the DELIBERATE CORRECTION refusal above, by design.--ranreconciliation: 134 derived, 134 run, 0 NOT-MEASURED.Package suites and type checks at `5147ad6a3a`
@objectstack/plugin-auth: Test Files 285 passed (285), Tests 5969 passed, 10 skipped.@objectstack/runtime: Test Files 613 passed (613), Tests 11388 passed, 23 skipped (run at79a6877ea1, the four fixture changes; after it,7a9d7e5068only removes an unused constant those suites never read, and the CI Test Core shards at5147ad6a3apass).@objectstack/verify: Test Files 52 passed (52), Tests 445 passed.@objectstack/organizations: Test Files 20 passed (20), Tests 266 passed.ui:vitest runoverpackages/app-shell/src/console/organizations/,packages/app-shell/src/console/auth/andapps/console/src/pages/auth/: Test Files 69 passed (69), Tests 630 passed.turbo run typecheckover plugin-auth, runtime, verify, organizations and their dependents, plus dogfood), afterturbo run build --filter='./packages/*' --filter='./examples/*^...': Tasks 75 successful of 75, exit 0.Ablations: red, then restored
scripts/ablation-replace.mjs: the three rule files ran 26 of 52 cases red. Restored fromHEAD(each blob hash equalsHEAD's,git diff HEADempty): 52 of 52 green.invitation-acceptance-verified-address.test.ts, exactly the case for the same address created again through the operator door. Restored fromHEAD(blob hash equal,git diff HEADempty).Dogfood battery
Not re-run in this round: no door-level assertion moved. The one dogfood fixture change of the first round stands, and that round's battery passed at
48e427708a(Test Files 479 passed, 3 skipped; Tests 4067 passed, 68 skipped). CI's Dogfood Regression Gate succeeded at5147ad6a3a.Generated by Claude Code