Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
76b6d9c
wip(plugin-auth): accepting an organization invitation requires a ver…
claude Nov 17, 2026
776d9a1
test(plugin-auth): accepting an organization invitation requires a ve…
claude Nov 17, 2026
cf95aa5
fix(plugin-auth)!: an invitation's acceptance, decline, read and list…
claude Nov 17, 2026
65652db
chore(changeset): name the Console packages the accept page change sh…
claude Nov 17, 2026
9736d09
test: invitees verify their address before they accept an invitation
claude Nov 17, 2026
446579f
Merge remote-tracking branch 'origin/main' into claude/sec2-q2gv
claude Nov 17, 2026
5c6c591
fix(plugin-auth)!: accepting, declining and listing an invitation nee…
claude Nov 17, 2026
42edc8b
fix(plugin-auth)!: fixtures mint members through the operator door; d…
claude Nov 17, 2026
809bd3f
chore(changeset): name the verify package the fixture door ships in
claude Nov 17, 2026
7a6ebac
Merge remote-tracking branch 'origin/main' into claude/sec2-q2gv
claude Nov 17, 2026
48e4277
chore(changeset): state the sign-up binding rule as a rule
claude Nov 17, 2026
3536fcf
fix(plugin-auth): an invitation sign-up's admission is held on the re…
claude Nov 17, 2026
79a6877
test(runtime): fixture members enter through the operator door
claude Nov 17, 2026
7da458b
fix(app-shell)!: an invitation sign-up whose address is not verified …
claude Nov 17, 2026
7a9d7e5
test(runtime): drop the fixture's unused organization id; docs state …
claude Nov 17, 2026
5147ad6
Merge remote-tracking branch 'origin/main' into claude/sec2-q2gv
claude Nov 17, 2026
bf3bf85
Merge branch 'main' into claude/sec2-q2gv
objectstack-fleet[bot] Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions .changeset/34272-accept-invitation-verified-email.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
---
'@objectstack/plugin-auth': patch
'@object-ui/app-shell': patch
'@objectstack/runtime': patch
---

fix(plugin-auth,app-shell)!: while mail is live, accepting an invitation needs a verified address
fix(plugin-auth,app-shell): an accept refused for an unverified address answers the vendor's own code, and the Console's accept page takes the person to verify

Clause-②: no (narrowing)
Clause-②: no
Metadata-protocol: none
Skills-docs: none — `git grep` of `skills/` finds no page that teaches accepting an invitation or `/organization/accept-invitation`; the rule is stated here and in the self-hosting docs.
Skills-docs: none — `git grep` of `skills/` finds no page that teaches accepting an invitation or `/organization/accept-invitation`; the rule is stated in the self-hosting docs.

<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value, metadata type or stored row is added, removed, renamed or rewritten: the moved answer is whether one auth route accepts a request from a session whose address is unverified, while the deployment's mail transport is live. Nothing exists for a migration to rewrite; the one-line fix for a refused person is in the body: verify the address, then accept. -->

**BREAKING** for a person who accepts an invitation from an account whose address was never verified, on a deployment whose mail transport is live. The rule: while mail is live, accepting an invitation needs a verified address, because an unverified address is not proof of the invited mailbox.
The rule that refuses the accept is stated, with its BREAKING notice and its migration, in this release's entry "accepting, declining and listing an organization invitation need a verified email address on every deployment, and an invitation sign-up joins by accepting once verified". This entry carries only the parts of that change that ship beside it.

**What changes.**

- `POST /api/v1/auth/organization/accept-invitation` (`@objectstack/plugin-auth`), from a session whose address is unverified, while the email service answers `isConfigured() === true`, now answers `403 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 answer `200` and 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's `beforeAcceptInvitation` hook, 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 own `403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION` and 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's `beforeAcceptInvitation` hook, on the session user the vendor itself resolved (cookie or bearer token alike).
- The Console's accept page (`@object-ui/app-shell`) answers that refusal with the verification-mail screen (`/verify-email-prompt`) for the account's address, whose link returns to the accept page, instead of a toast.

**Who moves.** A person in that state verifies their address (the Console's accept page takes them to the screen that sends the mail), then accepts; an API client that accepts for its user does the same, through `POST /api/v1/auth/send-verification-email`. A visitor who is not signed in and opens the invitation mail's own link is not affected: the accept page offers the one-step form, which verifies the address as it accepts. A visitor already signed in to an account whose address is unverified who opens the same link accepts through `/organization/accept-invitation`, so is refused as above and sent to verify.

**Unchanged.** Every deployment without a live mail transport (no email service, or the log transport), where nothing could verify an address, so acceptance stays open to an unverified address; `get-invitation`, `list-user-invitations` and `reject-invitation`, which write no membership; the one-step door `POST /api/v1/auth/organization/accept-invitation-one-step`; and a verified session everywhere. better-auth's `requireEmailVerificationOnInvitation` stays declared `false`: it governs reading and declining too, and is read once at boot.

`@objectstack/runtime` carries only the dispatcher error-vocabulary row that classifies the vendor code above as foreign vocabulary; nothing it runs changes.
28 changes: 28 additions & 0 deletions .changeset/invitation-acceptance-verified-address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'@objectstack/plugin-auth': patch
'@objectstack/verify': patch
'@object-ui/app-shell': patch
---

fix(plugin-auth)!: accepting, declining and listing an organization invitation need a verified email address on every deployment, and an invitation sign-up joins by accepting once verified

Clause-②: no (narrowing) — narrowed: from a session whose email address is not verified, `POST /api/v1/auth/organization/accept-invitation` and `POST /api/v1/auth/organization/reject-invitation` answer `403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION` and `GET /api/v1/auth/organization/list-user-invitations` answers `403 EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION`, on every deployment, whatever the state of its mail transport; nothing is accepted or declined and no membership is written. Under the `invite_only` posture with `membershipPolicy: 'auto'`, a sign-up admitted by the invitation it presents is not bound to the Default Organization while its address is unverified; it joins by accepting the invitation. The codes are better-auth's own. The `sys_invitation` actions **Accept Invitation** and **Decline Invitation** post to those routes and answer the same.
Metadata-protocol: none
Skills-docs: none — no skill under `skills/**` teaches accepting an organization invitation or invitation sign-up; `content/docs/deployment/self-hosting.mdx` gains the rules in this change.

<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed, renamed or re-shaped. The moved answers are runtime refusals at three organization invitation routes and a membership the sign-up seam does not write for an unverified invitation sign-up, so there is nothing stored for a migration to rewrite and no tombstone. -->

**BREAKING** for a deployment whose people answer invitations with an address that is not verified: email verification off (the default under `invite_only`, or declared off under `open`), no live mail transport, or a social or SSO provider that does not verify the address.

- Accepting, declining and listing an organization invitation require a verified email address, on every deployment. A password account verifies by 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.
- Reading one invitation by its id (`GET /api/v1/auth/organization/get-invitation`) stays open, so the accept page can show it.
- Under `invite_only` with `membershipPolicy: 'auto'`, an account a sign-up admitted by the invitation it presents is not bound to the Default Organization while its address is unverified. Its membership comes from accepting the invitation once the address is verified, with the role the invitation carries, or from a platform administrator.
- 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.

Unchanged: the invitation mail's own link, which carries a proof of the mailbox and accepts in one step (`POST /api/v1/auth/organization/accept-invitation-one-step`); a verified account, which accepts, declines and lists its invitations as before; the first account of a deployment, accounts an administrator creates and accounts a boot command provisions, which are bound as before; sending, resending and cancelling invitations.

The Console's accept-invitation page answers a refused decline with the verification-mail screen for the account's address, as it answers a refused accept, and that screen's link brings the person back to answer the invitation.

`@objectstack/verify`: a booted stack's `signUp` mints its fixture member through the operator door (the ticket the stack's own auth manager stages for that address), so the account is bound at creation as before; a stack whose auth service offers no such door falls back to the invitation lane.

What to do: an invitee completes the verification mail (`POST /api/v1/auth/send-verification-email`, then the link it carries) before answering, or opens the invitation mail's own link. On a deployment with no live mail transport, a platform administrator creates the account (`POST /api/v1/auth/admin/create-user`) or attaches an account that already exists with the member list's **Add Member** action, which is open to platform administrators only and attaches existing accounts only.
2 changes: 1 addition & 1 deletion content/docs/deployment/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Read by `@objectstack/service-print` when `PrintServicePlugin` is composed; see
| `OS_AUTH_EMAIL_PASSWORD_ENABLED` | boolean | settings default | Settings env override for `auth.email_password_enabled`. Controls local email/password login. |
| `OS_AUTH_SIGNUP_ENABLED` | boolean | settings default | Settings env override for `auth.signup_enabled`. Takes precedence over UI settings and is preferred over `OS_DISABLE_SIGNUP`. |
| `OS_AUTH_REQUIRE_EMAIL_VERIFICATION` | boolean | settings default | Settings env override for `auth.require_email_verification`. Under the `open` audience posture, `false` is the deployment's opt-out from the forced verification (one boot warning; see [Email verification under each posture](/docs/deployment/self-hosting#email-verification-under-each-posture)); under `email_domain` it is refused, since verification is forced there. |
| `OS_AUTH_MEMBERSHIP_POLICY` | `auto` \| `invite-only` | `auto` | Settings env override for `auth.membership_policy` — what a newly created user joins (ADR-0093 D1). `auto` binds every new user to the deployment's default organization. `invite-only` grants membership solely through an explicit act: creating a workspace, accepting an invitation, an admin adding them, or SSO just-in-time provisioning. Applies to sign-up **and** to the backfill of pre-existing member-less users. An unrecognized value is rejected with an `error` log and **ignored** — the deployment keeps its current policy rather than silently reverting to `auto`. |
| `OS_AUTH_MEMBERSHIP_POLICY` | `auto` \| `invite-only` | `auto` | Settings env override for `auth.membership_policy` — what a newly created user joins (ADR-0093 D1). `auto` binds every new user to the deployment's default organization, except, under the `invite_only` audience posture, a sign-up admitted by the invitation it presents whose address is unverified, which joins by accepting. `invite-only` grants membership solely through an explicit act: creating a workspace, accepting an invitation, an admin adding them, or SSO just-in-time provisioning. Applies to sign-up **and** to the backfill of pre-existing member-less users. An unrecognized value is rejected with an `error` log and **ignored** — the deployment keeps its current policy rather than silently reverting to `auto`. |
| `OS_ORG_INVITATION_LIMIT` | integer \| `off` | unset (100) | How many **pending** invitations one organization may hold at once. When the organization already holds that many, `POST /api/v1/auth/organization/invite-member` answers `403 INVITATION_LIMIT_REACHED` (`Invitation limit reached`) until an invitation is accepted, rejected, cancelled or expires. Unset keeps the auth library's own limit of 100, so a deployment that sets nothing behaves as before. A positive integer `N` allows `N`. `off`, `unlimited` or `none` (any case) removes the limit, for a host that invites people in bulk. `0`, or any value that is not plain digits (`-5`, `2.5`, `1e3`, `1_000`), reads as unset (100), so a typo never refuses every invitation. The count is per organization, not per inviter. Read when the auth plugin builds its organization plugin, so a change needs a process reload. |
| `OS_AUTH_GOOGLE_ENABLED` | boolean | settings default | Settings env override for `auth.google_enabled`. Requires Google OAuth credentials from Settings or env. |
| `GOOGLE_CLIENT_ID` | string | — | Deployment-level Google OAuth client id for the open-source Google login implementation. |
Expand Down
57 changes: 36 additions & 21 deletions content/docs/deployment/self-hosting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -755,26 +755,41 @@ presents.** The sign-up sends the invitation's `id`, the last segment of its
`/accept-invitation/` link, as `invitationId` beside the email: the Console's
register page does this for an invitee who arrived from the link, and
`os register --invitation` does it from a terminal. An address alone gets the
same `403 SELF_REGISTRATION_CLOSED` as an address nobody invited. The link
reaches the invitee in the invitation mail; on a deployment with no mail
transport, an administrator hands it over with the invitation's **Copy Invite
Link** action. The first account of a new deployment needs no invitation.

**While the mail transport is live, accepting an invitation needs a verified
address.** `POST /api/v1/auth/organization/accept-invitation` from a session
whose address was never verified answers `403
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION` and
writes nothing: an unverified address does not prove the person holds the
invited mailbox. The Console's accept page sends the person to the
verification-mail screen for their address, and the link in that mail brings
them back to accept. A visitor who is not signed in and opens the invitation's
link from the invitation mail itself needs no separate step: the accept page
offers the one-step form, which verifies the address as it accepts. A visitor
already signed in to an unverified account who opens that link is sent to
verify first, like any other unverified session. Reading, listing and declining an invitation are not affected. On a
deployment with no live transport (none configured, or the log transport)
nothing can verify an address, so acceptance stays open to an unverified
address, as before.
same `403 SELF_REGISTRATION_CLOSED` as an address nobody invited. The first
account of a new deployment needs no invitation. Admission is all the
invitation's `id` grants: the account it admits joins no organization until it
accepts the invitation, and accepting needs a verified address.

**Accepting, declining and listing an invitation need a verified email
address, on every deployment.** The invitation's `id`, which its link carries,
proves nothing about the mailbox. From a session whose address is not
verified, `POST /api/v1/auth/organization/accept-invitation` and
`POST /api/v1/auth/organization/reject-invitation` answer `403
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION` and write
nothing, and `GET /api/v1/auth/organization/list-user-invitations` answers `403
EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION`. Reading one invitation by its id
(`get-invitation`) stays open, so the accept page can show it. A password
account verifies through the verification mail; an account a social or SSO
sign-in made counts only when its provider verified the address. The Console's
accept page sends an unverified person to the verification-mail screen, and
the link in that mail brings them back to accept. A visitor who is not signed
in and opens the link from the invitation mail itself needs no separate step:
the accept page offers the one-step form, which verifies the address as it
accepts. No setting relaxes this rule.

**A deployment without a live mail transport cannot onboard a password
account by invitation link.** With no transport configured, or the log
transport, no verification mail and no invitation mail reaches anyone, so an
invitee who signs up with a password cannot verify the address or accept; a
link handed over with the invitation's **Copy Invite Link** action admits the
sign-up and nothing more. The one exception is an invitee who signs in through
a social or SSO provider that verifies the address: that account counts as
verified, so it can accept a copied link without any mail. To bring anyone
else in there, a platform administrator creates the account
(`POST /api/v1/auth/admin/create-user`), or attaches an account that already
exists with the member list's **Add Member** action. Add Member is open to
platform administrators only, and it attaches existing accounts only: it
creates no account and sends no invitation.

**What decides it on `open` and `email_domain`.** A sign-up for an address that
already has an account gets the same answer as a successful new sign-up, and
Expand Down Expand Up @@ -831,7 +846,7 @@ has a cost:
`/api/v1/auth/config` reports `requireEmailVerification: false` — the value
actually wired.
- Anyone can register an address they do not control. An organization
invitation sent to that address can then be accepted by that account.
invitation sent to that address still waits for the address to be verified.
- It is the deployment's to declare. A `false` stored only through the
settings console is refused under `open`, and verification stays on.

Expand Down
4 changes: 4 additions & 0 deletions content/docs/deployment/tenancy-modes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ The reconciler:
- **yields** to any membership that already exists (e.g. one created by an
invitation, `add-member`, SSO provisioning, or a host hook) — it never
creates a second membership;
- does **not** bind, under the `invite_only` audience posture, a sign-up
admitted by the invitation it presents while the account's email address is
unverified: that account joins by accepting the invitation, which needs a
verified address ([Self-hosting](/docs/deployment/self-hosting));
- binds only to an **unambiguous** target org — that is `tenancy.defaultOrgId()`,
which returns the single-org default organization under `single` and `null`
under any walled **request** (invitations, `add-member` and SSO provisioning
Expand Down
8 changes: 5 additions & 3 deletions content/docs/permissions/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ OS_AUTH_SIGNUP_ENABLED=false
OS_AUTH_GOOGLE_ENABLED=true

# Optional: what a new user joins (ADR-0093 D1). `auto` (default) binds every
# new user to the default organization; `invite-only` grants membership only
# new user to the default organization (except, under the `invite_only`
# audience posture, a sign-up admitted by the invitation it presents whose
# address is unverified: it joins by accepting); `invite-only` grants membership only
# through an explicit act — creating a workspace, accepting an invitation, an
# admin adding them, or SSO just-in-time provisioning.
# Also configurable in Setup → Authentication → Membership.
Expand Down Expand Up @@ -1208,8 +1210,8 @@ organization the administrator has switched to in the console. There is no
organization choice: to add someone to another organization, switch to it
first. An administrator with no current organization is refused with
`400 NO_ACTIVE_ORGANIZATION` and no user is created. Under the `single` posture
(a degraded wall included) the user joins the default organization, as every new
user does ([Membership](/docs/deployment/tenancy-modes#membership-how-new-users-join-an-organization)).
(a degraded wall included) the user joins the default organization, as every
user an administrator creates does ([Membership](/docs/deployment/tenancy-modes#membership-how-new-users-join-an-organization)).

The join is better-auth's `addMember`, the same act as **Add Member**, inside
the account's transaction: an organization at its membership limit refuses the
Expand Down
Loading
Loading