Commit 4f24e9d
feat(spec,auth)!: one declared audience posture for self-registration — invite_only|email_domain|open, default invite_only (#11767)
* feat(spec): audience posture vocabulary on AuthConfig — invite_only|email_domain|open, default invite_only
Closed vocabulary + runtime value list + type guard (MembershipPolicy
precedent), completeness predicates in the schema (email_domain requires
non-empty domains; self-registration-permitting postures require the
declared permission set; inert declarations refused per ADR-0078), two
registered error codes (SELF_REGISTRATION_CLOSED, EMAIL_DOMAIN_NOT_ALLOWED)
and the audiencePosture non-flag public-config key. Artifacts regenerated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(plugin-auth): enforce the audience posture at better-auth's admission seam
One decision owner (decideAudienceAdmission) wired at user.validateUserInfo
for every creation path, plus the sign-up before-hook raise that the
vendor's anti-enumeration shield forces (a 403 from the creation seam is
converted to a synthetic 200 when requireEmailVerification is on — measured
on dist/api/routes/sign-up.mjs:163,235). Pending invitations admit under
every posture; enterprise-IdP JIT is provider-class; self-registrants
receive the DECLARED permission set via sys_user_permission_set or are not
admitted at all.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(plugin-auth): audience-posture matrix + fixture triage for the invite_only default
New audience-posture suite (pure decision matrix, entry refusals, wire
outcomes incl. the landed permission-set grant). Existing harness suites
create their non-first fixture users through the invitation carve-out
(audience-gate-test-support) — the real admission lane under the new
default, chosen over an open posture because open forces email
verification and would stop sign-up from minting the sessions these
suites exercise.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: ADR-0087 semantic entry + minor changeset for the audience-posture default flip
Registered audience-posture-default-invite-only (the
rest-requireauth-default-flip class: a secure-default flip no transform
can decide); pinned ledger regenerated for the new engine double.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore(spec): regenerate os-regen artifacts on the merged tree
Discharges the os-regen deferral recorded by the merge commit. The two
driver-deferred artifacts (content/docs/references/index.mdx and the
strictness-ledger counts) are regenerated from the merged sources; the
remaining eight os-regen paths were reset to origin/main and regenerated
back to byte-identical content, which is the evidence the textual merge
dropped nothing.
* fix(plugin-auth): make the audience bootstrap bypass answerable at its seam
The #11739 bootstrap bypass never fired on a real deployment. Its probe was
`ctx.context.adapter.findOne({ model: 'user', where: [] })`; `where: []` lowers
to an empty filter and the real ObjectQL engine's `requireFindOnePredicate`
(#4419) REFUSES a findOne that selects no particular record. The surrounding
`catch { return false; }` read that refusal as "users exist", so every
bootstrap creation was judged non-bootstrap and the new `invite_only` default
refused the operator's own first account — including the dev-admin seed's.
Fix, without touching the posture's ruled semantics or its fail-closed floor:
- `isBootstrapCreation` asks the question in a form that can be ANSWERED — a
bounded `find` through `withSystemReadContext`, the same ctx-independent data
path `hasPendingInvitationFor` uses one frame away. An unanswerable probe
still reads as NOT bootstrap.
- The population predicate is HUMANS, not rows: `isHumanUserRow` is now the one
owner, shared by the gate and by the dev-admin seed's own precondition, which
had spelled the same filter by hand. They must agree — a DB still carrying
the legacy `usr_system` row is exactly where they would have diverged, with
plugin-security announcing "no human users yet" while the gate refused that
very sign-up.
- The sibling `disableSignUp` bootstrap bypass carried the identical dead probe
and now routes through the same helper.
Pinned by `audience-bootstrap-seam.test.ts` over a REAL ObjectQL engine, and
through the server-side `api.signUpEmail` lane the dev seed actually uses — the
two things no existing suite exercised. Case 0 asserts the #4419 refusal
itself, so the reason a fake engine cannot pin this is under test rather than
asserted in prose.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(verify): fixture sign-ups enter through the invitation carve-out
#11739 made `invite_only` the default audience posture. The verify harness's
`signUp` helper exists to mint the SECOND, THIRD… fixture identity — the very
population the wall now closes — so every fixture that needs a plain member
died with 403 SELF_REGISTRATION_CLOSED once the dev-admin seed was unblocked.
Seed a pending `sys_invitation` for the address first, which is the same lane
plugin-auth's own suites take (`audience-gate-test-support.ts`) and for the
same two reasons: `open`/`email_domain` would force email verification on and
stop sign-up minting the token this helper returns, and the invitation lane
keeps the audience gate honestly ON the path — the carve-out is a real
admission verdict, not a bypass. Best-effort: an unreachable engine just signs
up and lets the gate answer.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(changeset): record the bootstrap-bypass population rule and the verify harness lane
Two facts the audience-posture changeset did not carry: the bootstrap bypass
counts non-system HUMANS rather than sys_user rows (so a legacy usr_system row
is still a fresh install), and @objectstack/verify's stack.signUp now enters
through the invitation carve-out — which a consumer counting their own pending
invitations needs to know about.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 1e79aa4 commit 4f24e9d
42 files changed
Lines changed: 2507 additions & 51 deletions
File tree
- .changeset
- content/docs/references
- api
- system
- docs/audits
- packages
- plugins/plugin-auth/src
- spec
- api-surface
- authorable-defaults
- authorable-surface
- export-origins
- json-schema.manifest
- src
- api
- kernel
- migrations
- entries/semantic
- system
- verify/src
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
| 396 | + | |
395 | 397 | | |
396 | 398 | | |
397 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
| 321 | + | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| 76 | + | |
63 | 77 | | |
64 | 78 | | |
65 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
146 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
| |||
0 commit comments