Commit 08f93bc
* fix(auth): gate organization/create on OS_TENANCY_POSTURE, not the demoted OS_MULTI_ORG_ENABLED (#5233)
ADR-0105 D1 made `OS_TENANCY_POSTURE` the canonical tenancy knob and demoted
`OS_MULTI_ORG_ENABLED` to a back-compat INPUT of `resolveTenancyPosture()`.
Two sites in AuthManager kept reading the demoted boolean directly, so a
deployment configured the documented way — posture only, legacy boolean unset —
mounted the entire organization wall and still answered
`403 Creating additional organizations is disabled on this deployment.`
- `organizationHooks.beforeCreateOrganization` now judges
`postureEnforcesWall(resolveTenancyPosture())`, the same knob serve.ts's
ADR-0093 D5 boot guard keys on. Intent unchanged (single-org still refuses);
only the knob is corrected, so the gate reads the REQUESTED posture exactly
as the old boolean did.
- `/auth/config`'s `features.multiOrgEnabled` keeps preferring the `tenancy`
service, but its no-service fallback now resolves the posture instead of the
demoted boolean.
`resolveMultiOrgEnabled()`'s doc comment — which still instructed both of those
sites to call it, written before the demotion — now says the opposite.
Its code semantics, and resolveTenancyPosture()'s fallback chain, are untouched.
New `org-create-posture-gate.test.ts` drives the real better-auth pipeline
(sign-up + POST /organization/create through AuthManager.handleRequest) across
posture-only, legacy-only, group, single and degraded deployments, and asserts
`/auth/config` predicts the route's answer in each. Ten of its cases fail
against the pre-fix source.
Fixes #5233
Refs cloud#1012, cloud#1020, #5261, #5262
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015W6nhsDrz6zWQc8je12a1t
* test(plugin-auth): pin org-create posture gate's engine double to ObjectQL delete dispatch
The #5233 fake engine's delete() accepted call shapes ObjectQLEngine.delete
refuses, so check:engine-double-contract flagged it as an unpinned double.
Route it through assertEngineDeleteDispatch from '@objectstack/objectql' —
the same in-package pattern as auth-manager.jwt-eddsa-fallback.test.ts and
session-of-record.test.ts (#4550) — rather than taking a baseline entry.
The devDependency was already present from #5044.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015W6nhsDrz6zWQc8je12a1t
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1b9a53b commit 08f93bc
4 files changed
Lines changed: 534 additions & 29 deletions
File tree
- .changeset
- packages
- plugins/plugin-auth/src
- types/src
| 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 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1891 | 1892 | | |
1892 | 1893 | | |
1893 | 1894 | | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | | - | |
1898 | | - | |
1899 | | - | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
1900 | 1909 | | |
1901 | 1910 | | |
1902 | 1911 | | |
| |||
1913 | 1922 | | |
1914 | 1923 | | |
1915 | 1924 | | |
1916 | | - | |
| 1925 | + | |
1917 | 1926 | | |
1918 | 1927 | | |
1919 | 1928 | | |
| |||
3185 | 3194 | | |
3186 | 3195 | | |
3187 | 3196 | | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
3188 | 3225 | | |
3189 | 3226 | | |
3190 | 3227 | | |
| |||
3244 | 3281 | | |
3245 | 3282 | | |
3246 | 3283 | | |
3247 | | - | |
3248 | 3284 | | |
3249 | | - | |
3250 | | - | |
3251 | | - | |
3252 | | - | |
3253 | | - | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
3254 | 3298 | | |
3255 | | - | |
3256 | | - | |
| 3299 | + | |
| 3300 | + | |
3257 | 3301 | | |
3258 | 3302 | | |
3259 | 3303 | | |
| |||
0 commit comments