Skip to content

Commit 7d8dcf6

Browse files
docs(adr-0093): a sign-up admitted by its invitation alone is not bound while its address is unverified (#34909)
Clause-②: no Metadata-protocol: none > **Governed / Tier H.** This diff touches `docs/adr/**` only, a Tier H row of `GOVERNED_SURFACES`. It is security-touching, so the low-risk add-only arm does not apply: it lands by the maintainer's hand or an authorized approval. It records rules that are already on `main`: #34883 (`invite_only`) and #34969 (`email_domain`). ## 维护者速读 - 改了什么:ADR-0093 加一条带日期的修订,含状态行一句、D1 下一段修订说明(D1 自助注册一句加“除 2026-11-17 修订外”的指引)、D7 边界表两行。规则是:只凭邀请获准的注册,邮箱未验证时不绑定组织,验证后接受邀请入组,或由平台管理员加入。覆盖两种情形:`invite_only` 下凭所出示邀请获准的注册;`email_domain` 下地址不在白名单、凭发给它的待接受邀请获准的自助注册。白名单内的地址按域名规则获准,照旧绑定。 - 为什么改:按维护者裁决(security#2)把已落地的规则记进 ADR,D1“每个用户创建即入组”的表述不再与代码相左。`invite_only` 部分已由 #34883 落地,`email_domain` 部分已由 #34969 落地。 - 风险与回滚:纯文档,无代码;回滚即 revert。 - 先看:`docs/adr/0093-tenancy-mode-and-membership-lifecycle.md` 的状态行和 D1 下的修订说明。 - 两分钟验证:`pnpm check:adr-anchors && node scripts/check-adr-links.mjs`,预期都为 0。 - 需要你做的:按 Tier H 批准本 PR。 ## What changes All in `docs/adr/0093-tenancy-mode-and-membership-lifecycle.md`, following the house style of the ADR's existing dated amendments: - **Status line:** one `**Amended**` entry, dated 2026-11-17 and citing the maintainer ruling (security#2), for D1 and D7. It follows the D3 entry that `main` added the same day, which is kept as it stands on `main`. A sign-up admitted by its invitation alone is not bound while its email address is unverified. The two cases are `invite_only` (the invitation the sign-up presents) and `email_domain` (an address off the allowlist that a pending invitation admitted). Such a sign-up joins by accepting the invitation. - **D1, the self-signup bullet:** an italic pointer, *Except as amended 2026-11-17, below.*, marked the way D8.1 is marked. - **D1, the amendment note:** with `membershipPolicy: 'auto'`, a sign-up admitted by its invitation alone is not bound while its email address is unverified. The note names both cases: - (a) `invite_only`: a sign-up admitted by the invitation it presents; - (b) `email_domain`: a self-serve sign-up whose address is off the allowlist and that a pending invitation addressed to it admitted. An address on the allowlist is admitted by the domain rule and binds as before. The note also says: - Such an account joins by accepting the invitation once its address is verified, with the invitation's role, or a platform administrator adds it. - Verifying the address later binds nothing by itself; membership is decided at creation (D7). - Every other creation binds as D1 states. - The rule is enforced by `auth-manager-membership-admission.ts#settleMembership`, which reads the admission that `audience-posture.ts#isAdmittedByInvitationAlone` decides. Both functions were checked against `main`. - **D7:** two edge-case rows, one for `invite_only` and one for `email_domain`. No code, schema, changeset or published file changes. ## Acceptance notes - It records rules already on `main`: #34883 for `invite_only` and #34969 for `email_domain`. - Rule-level wording only. ## Verification At head `3e95e07145`, the merge of `origin/main` (which carries #35035's D3 amendment): - The status line keeps both 2026-11-17 entries. #35035's entry and its D3 amendment note are byte-identical to `main`. This PR's status-line entry, D1 pointer, D1 note and both D7 rows are byte-identical to `f28d2257c1`. Compared with `main`, nothing else in the file moves: 1 file, +28/−1. - `pnpm check:adr-anchors`: exit 0. - `node scripts/check-adr-links.mjs`: exit 0. - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 21 families for the diff, against merge base `1282a464e`. All 21 ran and exited 0, once the `@objectstack/lint` closure was built for `check:doc-formula-expressions`. `--ran` reconciliation: 21 derived, 21 run, 0 NOT-MEASURED. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj)_ <!-- signed: security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9f352e8 commit 7d8dcf6

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

‎docs/adr/0093-tenancy-mode-and-membership-lifecycle.md‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR-0093: Tenancy mode as a first-class capability, and a single owner for the user→membership lifecycle
22

3-
**Status**: Accepted (2026-07-13) — implemented: `tenancy` kernel service (`plugin-auth/src/tenancy-service.ts`), membership reconciler (`reconcile-membership.ts`), locked by `dogfood/test/membership-reconciler.dogfood.test.ts` · **Amended** (2026-11-08, [ADR-0151](./0151-ai-service-account-a-headless-agent-is-a-registered-principal-of-its-own.md) D1, proposed, adopted by its merge) — D7's machine / service-account row: the first-class marker it waited on is `sys_user.principal_kind`. The membership reconciler never binds an account of kind `agent`, whose one membership its registration creates. · **Amended** (2026-11-11, maintainer ruling 6796108313) — D8.1 reversed: under every tenancy posture, a person's data access requires a current membership in the organization, judged on each request; see the amendment note under D8. · **Amended** (2026-11-17, maintainer ruling 6942842013) — D3 amendment: under a walled posture, bulk import (`POST /api/v1/auth/admin/import-users`) joins each row to the administrator's current organization; see the amendment note under the D3 amendment.
3+
**Status**: Accepted (2026-07-13) — implemented: `tenancy` kernel service (`plugin-auth/src/tenancy-service.ts`), membership reconciler (`reconcile-membership.ts`), locked by `dogfood/test/membership-reconciler.dogfood.test.ts` · **Amended** (2026-11-08, [ADR-0151](./0151-ai-service-account-a-headless-agent-is-a-registered-principal-of-its-own.md) D1, proposed, adopted by its merge) — D7's machine / service-account row: the first-class marker it waited on is `sys_user.principal_kind`. The membership reconciler never binds an account of kind `agent`, whose one membership its registration creates. · **Amended** (2026-11-11, maintainer ruling 6796108313) — D8.1 reversed: under every tenancy posture, a person's data access requires a current membership in the organization, judged on each request; see the amendment note under D8. · **Amended** (2026-11-17, maintainer ruling 6942842013) — D3 amendment: under a walled posture, bulk import (`POST /api/v1/auth/admin/import-users`) joins each row to the administrator's current organization; see the amendment note under the D3 amendment. · **Amended** (2026-11-17, maintainer ruling (security#2)) — D1 and D7: a sign-up admitted by its invitation alone is not bound while its email address is unverified — under `invite_only`, one admitted by the invitation it presents; under `email_domain`, one whose address is off the allowlist that a pending invitation admitted; it joins by accepting the invitation; see the amendment note under D1.
44
- **Date:** 2026-07-13
55
- **Deciders:** ObjectStack Protocol Architects
66
- **Implementation:** #2882 (Phase 0 — tactical create-user bind, merged) → this PR (Phases 1–3 — `tenancy` service, fail-fast boot guard, membership reconciler, consumer migration, backfill, docs). One revision from the original plan, ratified in D2: the endpoint-level create-user bind **delegates to the shared reconciler** (one implementation, two call sites) instead of being deleted. Runtime verification confirmed the hook fires for `admin.createUser`, but better-auth *defers* `user.create.after` post-commit (#1881), so the endpoint keeps its delegated call to report `organizationId` / `membershipCreated` deterministically in its response. Cloud-host semantics (personal-org hook precedence, multi-org non-binding, D5 blast radius) verified against `objectstack-ai/cloud` — see D2/D3/D5.
@@ -142,6 +142,7 @@ while the set of creation paths is still enumerable.
142142
- Self-signup follows the same policy — no signup-specific membership branch.
143143
(Whether signup is *open at all* remains the existing, separate registration
144144
toggle; this ADR does not couple the two.)
145+
*Except as amended 2026-11-17, below.*
145146
- Default role for auto-bound users is `member`. Elevation is a separate,
146147
audited action (`update-member-role`), never part of creation.
147148
- **`auto` joins; it never creates.** The reconciler binds a user to the one
@@ -168,6 +169,30 @@ for them.
168169
> explicitly). What `invite-only` decides is *who grants* the membership and
169170
> *when*, not whether a person who reaches the data holds one.
170171
172+
> *Amended 2026-11-17 (maintainer ruling (security#2)).* With
173+
> `membershipPolicy: 'auto'`, a sign-up admitted by its invitation alone is not
174+
> bound while its email address is unverified. Two cases:
175+
>
176+
> - (a) `invite_only`: a sign-up admitted by the invitation it presents;
177+
> - (b) `email_domain`: a self-serve sign-up whose address is off the allowlist
178+
> and that a pending invitation addressed to it admitted. Under
179+
> `email_domain`, an address on the allowlist is admitted by the domain rule
180+
> and binds as before.
181+
>
182+
> The invitation admits the account and nothing more: it does not prove the
183+
> invited mailbox, and accepting an invitation needs a verified address. Such
184+
> an account joins by accepting the invitation once its address is verified,
185+
> which writes the membership with the invitation's role, or a platform
186+
> administrator adds it. The decision stays at creation (D7): verifying the
187+
> address later binds nothing by itself. Every other creation binds as D1
188+
> states — the first account, an account an administrator creates, an account
189+
> the deployment's boot command provisions, and a sign-up the invitation mail's
190+
> own proof verifies. Enforced by
191+
> `packages/plugins/plugin-auth/src/auth-manager-membership-admission.ts#settleMembership`,
192+
> which reads the admission that
193+
> `packages/plugins/plugin-auth/src/audience-posture.ts#isAdmittedByInvitationAlone`
194+
> decides.
195+
171196
### D2 — One owner: the membership reconciler hook
172197

173198
plugin-auth composes a `user.create.after` step into `composeDatabaseHooks`,
@@ -457,6 +482,8 @@ admin surfaces.
457482
| Impersonation sessions | No change — active-org resolution is session-time, membership is create-time |
458483
| User leaves their only org | Allowed today, unchanged. The invariant governs *creation*, not the full lifecycle; a leave-then-rejoin flow is user intent |
459484
| Machine / service accounts | Out of scope now; when a first-class service-account marker exists, it should exempt from auto-bind (tracked as a follow-up, not blocking) |
485+
| Invitation sign-up, address unverified (`invite_only`) | Not bound at creation (amendment note under D1, 2026-11-17); joins by accepting the invitation once verified. Verifying later binds nothing by itself: membership is decided at creation |
486+
| Invitation sign-up off the allowlist, address unverified (`email_domain`) | Not bound at creation (amendment note under D1, 2026-11-17), as the `invite_only` row; an address on the allowlist is admitted by the domain rule and binds as before |
460487

461488
### D8 — Non-goals (explicit refusals)
462489

0 commit comments

Comments
 (0)