Commit 4578c76
committed
fix(tenancy): platform-global (tenancy.enabled:false) objects are never driver-org-scoped (#3249)
An org-context read of a platform-global object (e.g. sys_license,
ADR-0066) could return 0 rows for an authenticated caller while an
anonymous read saw the data: the engine stamped execCtx.tenantId into
driver options unconditionally, and the SQL driver's tenant-field cache
could be re-corrupted to organization_id by a partial re-registration
(lifecycle archive syncSchema, schema-drift re-sync) whose schema
omitted the tenancy block — the implicit organization_id heuristic then
org-scoped the table and its NULL-org rows vanished.
- spec: new isTenancyDisabled(schema) export from @objectstack/spec/data
— single source of truth for the ADR-0066 platform-global posture,
shared by registry (tenant-column injection), engine (tenantId
propagation) and drivers (native scoping).
- objectql: buildDriverOptions is now object-aware and withholds
execCtx.tenantId for tenancy-disabled objects (protects every driver
at the source). An explicitly-passed base tenantId still wins.
- driver-sql (+ inherited by driver-sqlite-wasm): sticky opt-out record
(tenantOptOutByTable) — a registration carrying a tenancy declaration
is authoritative; one without preserves a previously declared opt-out
instead of falling back to the organization_id heuristic. Rotation
shards inherit the opt-out.
- tests: driver-sql sticky re-registration regressions; port the
missing tenancy.enabled:false block to the sqlite-wasm suite; engine
tests for tenantId withholding on reads and writes.
The orWhereNull global-row inclusion (#2734) is unchanged as
defense-in-depth. plugin-security's inline posture checks
(security-plugin.ts:2794/2882) are a mechanical follow-up, not touched
here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017YcGcBgUxeeKXXxv189kqR1 parent 4b659d0 commit 4578c76
9 files changed
Lines changed: 305 additions & 25 deletions
File tree
- .changeset
- packages
- objectql/src
- plugins
- driver-sqlite-wasm/src
- driver-sql/src
- spec/src/data
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
533 | 603 | | |
534 | 604 | | |
535 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
789 | 797 | | |
790 | 798 | | |
791 | 799 | | |
792 | 800 | | |
793 | 801 | | |
794 | | - | |
| 802 | + | |
795 | 803 | | |
796 | 804 | | |
797 | 805 | | |
798 | 806 | | |
799 | 807 | | |
800 | 808 | | |
801 | 809 | | |
802 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
803 | 813 | | |
804 | 814 | | |
805 | 815 | | |
| |||
2183 | 2193 | | |
2184 | 2194 | | |
2185 | 2195 | | |
2186 | | - | |
| 2196 | + | |
2187 | 2197 | | |
2188 | 2198 | | |
2189 | 2199 | | |
| |||
2265 | 2275 | | |
2266 | 2276 | | |
2267 | 2277 | | |
2268 | | - | |
| 2278 | + | |
2269 | 2279 | | |
2270 | 2280 | | |
2271 | 2281 | | |
| |||
2362 | 2372 | | |
2363 | 2373 | | |
2364 | 2374 | | |
2365 | | - | |
| 2375 | + | |
2366 | 2376 | | |
2367 | 2377 | | |
2368 | 2378 | | |
| |||
2620 | 2630 | | |
2621 | 2631 | | |
2622 | 2632 | | |
2623 | | - | |
| 2633 | + | |
2624 | 2634 | | |
2625 | 2635 | | |
2626 | 2636 | | |
| |||
2945 | 2955 | | |
2946 | 2956 | | |
2947 | 2957 | | |
2948 | | - | |
| 2958 | + | |
2949 | 2959 | | |
2950 | 2960 | | |
2951 | 2961 | | |
| |||
3041 | 3051 | | |
3042 | 3052 | | |
3043 | 3053 | | |
3044 | | - | |
| 3054 | + | |
3045 | 3055 | | |
3046 | 3056 | | |
3047 | 3057 | | |
| |||
3149 | 3159 | | |
3150 | 3160 | | |
3151 | 3161 | | |
3152 | | - | |
| 3162 | + | |
3153 | 3163 | | |
3154 | 3164 | | |
3155 | 3165 | | |
3156 | 3166 | | |
3157 | 3167 | | |
3158 | 3168 | | |
3159 | 3169 | | |
3160 | | - | |
| 3170 | + | |
3161 | 3171 | | |
3162 | 3172 | | |
3163 | 3173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
301 | 329 | | |
302 | 330 | | |
303 | 331 | | |
| |||
0 commit comments