Skip to content

Commit 94e60c0

Browse files
fix(plugin-security)!: collectRLSPolicies applies an object's declared default row scope when no held set carries a row policy for it (#24451)
Fixes #24340 Clause-②: no (narrowing) — the narrowing is real only for a principal with no platform baseline whose permission sets carry no row policy for an object that declares a default (0 measured producers: no object in this tree declares `defaultRowScope`, ruling E′ item 7). ## What changed `collectRLSPolicies` (`packages/plugins/plugin-security/src/security-plugin.ts`), the one collection every read, write and explain door composes from, now applies an object's declared `ObjectSchema.defaultRowScope` (#24338) when the held sets' collection for that object and operation comes out empty. This is #24164 ruling E′ item 2, at the one collection point: - **When no held set carries a row policy for the object**, the object's default applies: one policy, `object` implied, built by `objectDefaultRowScopePolicy` (new, `object-default-row-scope.ts`) and marked by identity. - **An authored set policy is used as authored**: the default is never added to a non-empty collection. - **Superuser-bypass principals are untouched**: the bypass is decided by the callers before the collection, so they never reach it. - **An object with no default keeps today's behaviour**: the branch returns the held collection unchanged. The shipped sets are not edited (`default-permission-sets.ts` untouched), so their behaviour and explain output do not move; the platform-objects declarations and the registry rule are #24341's. ### What "carries a row policy" means (measured, then pinned) It is exactly what the collection already means by empty: the held sets' policies after the ADR-0105 D3 admission, `enabled`, the `positions` domain and `'*'` matching (`RLSCompiler.getApplicablePolicies`). So: - a held `'*'` policy counts (the default is not applied); - a held policy for another operation does not count (an object whose held sets scope only `update` reads under its default); - a held policy switched off or outside the caller's positions does not count. An object-level reading ("any held policy naming the object, any operation") was measured and rejected: `member_default` ships the wildcard ownership floor (`owner_only_writes` / `owner_only_deletes`, object `'*'`), so that reading would switch the default off for every baseline member on every object. The two readings agree on every declaration in sight: the identity defaults #24341 is to declare mirror the operations of the set literals they copy. The ADR-0095 D1 note words it as Layer 1 silence, which is the collection's emptiness. ### The default takes the path a held policy takes From the admission on, the default is a held policy: it passes the same ADR-0105 D3 admission (`admitCollectedPolicy`, extracted from the loop unchanged, so a default spelling a shipped tenant policy is stripped exactly as its set copy is, by the `(object, name, using)` provenance key), the same `getApplicablePolicies` filter (its own `operation`, `positions`, `enabled`), and the same compiler (`using`, `check`). ### Call sites (every one reads the same collection) | Call site (HEAD line) | What the collection is used for | What the default does there | |---|---|---| | `resolvePreImageFloorDrop` (`:5326`) | `.some(isPlatformOwnershipFloorPolicy)`: is the platform floor in play | Nothing: the default is collected only when the held collection is empty, so the floor is absent either way, and the default is never the floor (identity provenance). Answer unchanged. | | `checkAuthoredRowWrite` (`:5448`) | authored pre-check: a non-floor policy with `using`; empty answers `abstain` | Counts as the declaration it is, exactly as a held copy of it would, so it can answer `admit` for a row it admits. Pinned. | | `computeLayeredRlsFilter` Layer 1 (`:7222`) | read door, by-id pre-image, bulk write filter, `getReadFilter` / analytics, explain; empty means `layer1 = null`, no filter | Compiled into Layer 1: the reads and writes it governs are narrowed. Pinned. | | derive-from-select (`:7369`) | `update` / `delete` with no write-class `using` re-collects `select` | A `select` default scopes the derived write exactly as a held select policy does. | | `computeWriteCheckFilter` (`:7657`) | post-image check via `writeCheckPolicies`; empty means no check | The default's `check` (or its `using`, by the schema's default) judges the post-image. Pinned: handing your own row away is refused. | | `assertControlledByParentWrite` master leg (`:8907`) | `.some(isPlatformOwnershipFloorPolicy)` | Nothing, for the reason in the first row. | Which call sites read an empty collection as "no policy, no filter": the Layer 1 compile (`:7222`, and `:7369` behind it) and the post-image check (`:7657`). Which already refuse on empty: none refuses; `checkAuthoredRowWrite` abstains (its fail-closed direction) and the two floor probes answer `false`. On a compile failure every door fails closed through `RLS_DENY_FILTER`. ### Cost of the read The declaration is read off `ql.getSchema(object)`, the ObjectQL registry's resolved object (the schema every find compiles against, and the source `getObjectSecurityMeta` prefers): two in-memory map lookups behind the registry's merged-object cache, made only when the held collection is empty. No I/O and no parse on any path; a non-empty collection pays nothing. ### Explain names the object default Explain already identifies policies inside a composed filter by identity (`compiledPolicyNameOf`). `RLSCompiler.compileFilter` now also records when a compiled policy filter came from an object default (`compiledObjectDefaultRowScopeOf`), and explain reads it: - object-level: the `rls` layer's `detail` gains one sentence naming the default by `name`, with its `label` and `description`, and the declaring object, saying it is not a permission set. `contributors` stays `[]` (the spec's contributor kinds are `permission_set` / `position` / `system`; a structured object-level field would be a spec change, not taken). - record-grained: the rule is named after the default (`kind: 'rls_policy'`, `name` set to the default's own name, `via: 'object_default'`) instead of `business_rls`. A filter from held sets is explained byte-for-byte as before. ### A `using` that does not lower: why the runtime refusal suffices here (rider `6255162631`) The default reaches the same compiler an authored policy does, so a non-lowering `using` is dropped with the same "uncompilable predicate ... DROPPED" WARN and the clause fails closed to `RLS_DENY_FILTER`: zero rows, never a silent admission or a silent drop. Pinned on the same predicate in both forms (an object's default, and an authored set policy on a sibling object): both read zero rows, both WARN naming their policy, explain answers `denies` for both. The authoring lint (`validate-rls-predicate-enforceability.ts`) is not extended, for three reasons: 1. Extending it needs `RLS_PREDICATE_UNENFORCEABLE`'s explanation entry in `packages/lint/src/rule-explanations.ts` to change: the entry's shared `RLS_DROPPED_USING` paragraph says the object "disappears for every holder of the permission set", which is wrong for a default. That file has another in-flight holder (#23566), so per the claim it is not edited here; it is reported to the seat. 2. The refusal is loud at runtime and fails closed, the same posture the lint's own header accepts as survivable for authored policies. 3. Zero producers can write a non-lowering default today: no object in the tree declares the key, the Studio form omits it, and the only planned writers (#24341) copy literals that already pass the lint where they live in the shipped sets. The key's describe now says plainly that authoring checks do not judge this predicate. ## Spec-lane riders (rider `6256199121`) - `packages/spec/liveness/object.json`: `defaultRowScope` and its eight members flip to `live`, citing `collectRLSPolicies`, `objectDefaultRowScopePolicy` and explain's `objectDefaultRowScopeSource` as read points; `authorWarn` / `authorHint` dropped in the same edit. `label` / `description` are live by the README's display-key rule: explain shows them to the administrator. `state-counts/object.md` regenerated by `gen:liveness-counts` (live 53 to 61, planned 8 to 0). - `packages/spec/src/data/object.zod.ts`: the key's TSDoc and describe say what the reader does, in place of "is to apply" and "no server reads this key". - `packages/spec/src/security/rls.zod.ts`: `DefaultRowScopeSchema`'s TSDoc likewise. - `packages/lint/src/validate-org-axis-red-lines.test.ts`: the title and docblock name `defaultRowScope` as the one object-level policy; the assertion is unchanged. - Patch round 1 (claim surface extended by the seat's rework record `6259617731`): `.changeset/pre/24338-object-default-row-scope.md`, the pending #24338 release note, now says what the key does (see Acceptance notes), and the Studio form ledger's omit row for `object.defaultRowScope` in `packages/spec/src/system/metadata-form-zod-reconciliation.test.ts` gives the reason that is true now. - Generated by their own generators (`check:generated --fix`, only the two it proved stale): `content/docs/references/{data/object,api/metadata,system/migration}.mdx`, `packages/spec/liveness/state-counts/object.md`. ## Pins (`packages/plugins/plugin-security/src/object-default-row-scope.test.ts`) Real `SecurityPlugin` + `ObjectQL` over `SqlDriver`, the shipped sets, rows written past every scope. The identity objects are the platform's own declarations, each given in the fixture the default its sets copy today (`sys_user`'s two literals as the one `||` policy the key allows, rider A); `qa_note` is a test object. 1. No baseline, an authored `'*'` read set: reads only its own `sys_user`, `sys_session`, `sys_scim_user` rows plus its organisation's members on `sys_user`. CONTROL without the declarations: every row. 2. An authored policy on the object is applied alone (the default is not OR-ed in); a held `'*'` policy counts; a held policy for another operation, or outside the caller's positions, does not. 3. The write doors read the same collection: a by-id update of a row outside the default answers `RECORD_NOT_FOUND` / 404 (an unreadable target is absent), and handing your own row away fails the post-image check with `PERMISSION_DENIED` / 403. `checkAuthoredRowWrite` answers `admit` / `abstain` from the default. 4. The platform administrator reads every row, with and without the defaults. 5. Explain names the default (object-level detail; record-grained rule and `via`); CONTROL: an authored policy is not named as one. 6. A deployment with the baseline is byte-for-byte unchanged: for `member_default`, `viewer_readonly`, `organization_admin` and the platform admin, on the three identity objects, the served ids and the `JSON.stringify` of explain (`read` and `update`) are identical with and without the declarations. 7. A default whose `using` does not lower is refused as an authored one is (zero rows, the WARN, explain `denies`). **Ablation (once, committed first, then reverted):** `node scripts/ablation-replace.mjs` replaced `if (held.length > 0) return held;` with `if (held.length >= 0) return held;` (anchor 1 to 0, blob `1e3792351de2` to `c54fe3ed549d`), ran the file: **10 failed / 6 passed**, the 10 being every default-dependent pin and the 6 exactly the controls (no-declaration control, authored-alone, held `'*'`, platform admin, authored explain control, baseline byte-for-byte). Restored: blob `1e3792351de2` equals `HEAD`, `git diff HEAD` empty. Direction observed: turned red, as expected. ## Tests and gates Final head `7702f3ca2`: patch round 1 (`ef9a7a01e`, the two corrected texts) with `origin/main` `26501ae24` merged in by `scripts/pm/os-regen-merge.sh`. The merge was a merge commit (no rebase, amend or force-push), and git carried the patch-round edit onto the moved `.changeset/pre/24338-object-default-row-scope.md` (blob `d5154221dd`). After a full `turbo run build`: - `pnpm --filter @objectstack/spec test`: 698 files, 21286 passed, 1 todo. `typecheck` exit 0. - The pin file: 16 passed. `pnpm --filter @objectstack/spec check:generated`: all 14 generated artifacts up to date, so no regeneration commit was owed after the merge. - plugin-security and lint: incoming `main` touched neither package's source, so their suites stand from the pre-merge head `1081739c9` (plugin-security 188 files, 3754 passed, 45 skipped; lint 145 files, 6864 passed; both typecheck exit 0). - Derived gate families: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derives 117 commands for this diff (17 paths, +788 / -102 against merge base `26501ae24`). All 117 were run on `7702f3ca2`, each through `scripts/pm/os-verify-lock.sh` with the command's own exit read from its VERDICT line, and `--ran` reconciles: **117 derived, 117 run, 0 NOT-MEASURED, 0 UNRUN**. 115 exit 0. - `node scripts/check-empty-changeset.mjs --base origin/main` exits 1, by design: its foreign-changeset rule names `.changeset/pre/24338-object-default-row-scope.md` as present on the merge base and changed here. That is the DELIBERATE CORRECTION class in Acceptance notes; `Check Changeset` is not a required context. - `pnpm check:platform-checklist` exits 1 with one problem (ABSENT SYMBOL `packages/core/src/security/resolve-authz-context.ts#legacyGrantAnchorRetired` in `areas/access-security.json`). Control leg: the same command in a detached worktree at the merge base `26501ae24` exits 1 with the same single problem, and earlier at `e22defb13` likewise. Pre-existing, not this change's. - The other changeset gates: `check-adr-0087-registration --base origin/main` exit 0, `check-changeset-no-major --base origin/main` exit 0. - Not run locally, declared to CI: `test:repo` (Test Core), and every family CI runs beyond the derived list. ## Acceptance notes - **A pending release note corrected in this PR (DELIBERATE CORRECTION, for confirmation here):** `.changeset/pre/24338-object-default-row-scope.md` is #24338's changeset. The version release `725a5b131` moved it from `.changeset/` into `.changeset/pre/`, and `release.yml` has the `pre exit` GA version consume `.changeset/pre/*.md` again, so the GA changelog is built from it. Its bullet "What it does today: nothing ..." and its sentence naming the `liveness-planned-property` warning became false with this PR's reader. Patch round 1 rewrites that one bullet to what the key does now (`collectRLSPolicies` applies it when the caller's held sets carry no row policy for the object and the operation) and drops the warning sentence; level, `Clause-②`, heading and every other line are unchanged. The edit rides the moved path through the merge of `main`. The already-released `next` changelog text stays as released. `check-empty-changeset`'s foreign-changeset rule refuses this file by design (the DELIBERATE CORRECTION class: do not restore it; confirm it on the PR), so `Check Changeset`, which is not a required context, stays red until the correction is confirmed. `skip-changeset` is not applied. - **The form ledger's omit reason corrected in this PR:** the omit row for `object.defaultRowScope` (`packages/spec/src/system/metadata-form-zod-reconciliation.test.ts`) now says the reader is in and a row policy is a composite form-face addition rather than a reconciliation. Prose only; the row's kind, path and the assertion are unchanged. - **Boundary, not filed:** the org-axis red-line rule (`validate-org-axis-red-lines.ts` rule ①) walks permission-set RLS only, so a `defaultRowScope.using` that walks the org parent is not judged there. That is a lint not covering metadata the runtime honours, which is outside the filing classes. - **Explain on a failing default:** a default whose `using` does not lower is explained as "composes to DENY ALL" without naming the default, exactly as an authored policy in the same state (the compiled identity is lost to the shared deny sentinel). - **`check:platform-checklist` exits 1 on this head and at the merge base alike** (one ABSENT SYMBOL in `areas/access-security.json`, `resolve-authz-context.ts#legacyGrantAnchorRetired`); this diff touches neither file. The control leg is in the gates section above. --- _Generated by [Claude Code](https://claude.ai/code/session_01Nk17Z26X5DB59iQztDBADH)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e11ae4b commit 94e60c0

17 files changed

Lines changed: 788 additions & 102 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
`defaultRowScope`'s describe, TSDoc and liveness row now say what the security plugin's reader does with the key
6+
7+
Clause-②: no — only describe, TSDoc and liveness-ledger text move; `ObjectSchema` and `DefaultRowScopeSchema` accept and refuse exactly what they did.
8+
9+
- `ObjectSchema.defaultRowScope`'s describe no longer says the key is not applied. It states what the row-policy collection does: the default applies when no permission set the caller holds carries a row policy for the object and the operation (a `'*'` policy counts; one switched off, outside the caller's positions, or for another operation does not), it is judged like a held policy, a `using` the compiler cannot lower makes the reads it governs return no rows with one server warning, and authoring checks do not judge that predicate. The TSDoc on the key and on `DefaultRowScopeSchema` say the same.
10+
- `liveness/object.json`: the `defaultRowScope` row and its eight members are `live`, citing the security plugin's collection, compiler and explain as their readers. Authoring the key no longer raises the `liveness-planned-property` warning.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/plugin-security': minor
3+
---
4+
5+
fix(plugin-security)!: the row-policy collection applies an object's declared `defaultRowScope` when no permission set the caller holds carries a row policy for the object
6+
7+
Clause-②: no (narrowing) — the narrowing is real only for a principal with no platform baseline whose permission sets carry no row policy for an object that declares a default; no object in this release declares one, and no export, option, schema or stored shape moves.
8+
9+
<!-- adr-0087: not-required (no-migration-prescription) A runtime row-scope narrowing at the security plugin's one row-policy collection, not a metadata change. No spec key, export, option, config field, response field or stored shape is removed, renamed or re-shaped: `ObjectSchema.defaultRowScope` already parses, and this change only gives it its reader, so there is no tombstone and nothing for `objectstack migrate meta` to rewrite. What narrows is the rows a principal reads on an object that declares a default when none of its permission sets carries a row policy for that object and operation: it now reads under the object's default instead of under no row filter. The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id covers the collection and this diff adds none (not registered / already-registered); and no published interface or type changes (not runtime-interface-only / type-surface-only). -->
10+
11+
**BREAKING** (an accept-set narrowing), shipped as `minor` under the launch-window convention for breaking changes.
12+
13+
`ObjectSchema.defaultRowScope` declares an object's default row-level security policy. Until now no server read it. The security plugin's row-policy collection (`collectRLSPolicies`), which every read, write and explain composes from, now applies it:
14+
15+
- **When it applies.** When the policies the caller's permission sets carry for the object and the operation come out empty, the object's default is collected in their place, for the declaring object. Empty means what the collection already meant by it: a held policy for every object (`'*'`) counts, while a held policy that is switched off, outside the caller's positions, or for another operation does not.
16+
- **How it is judged.** Exactly as a held policy: its `operation`, `positions` and `enabled` decide where it applies, and its `using` and `check` compile through the same compiler. So it scopes reads, the by-id and bulk write filters, and the post-image check, and `checkAuthoredRowWrite` reads it as the declaration it is. A `using` the compiler cannot lower is dropped with the same warning and fails closed to zero rows, as an authored policy's does.
17+
- **Explain** names an applied default as the object's own declaration, with its `name`, `label` and `description`: the row-level layer's `detail` says so, and a record-grained explanation names the rule after the default, reached `via: 'object_default'`.
18+
- **Unchanged:** a policy an authored set carries for the object is used as authored, with the default not added to it; a principal whose superuser bypass skips row policies never reaches the collection; an object that declares no default collects exactly what it collected before. A deployment that composes the platform baseline is unaffected for the identity objects, whose shipped sets carry their own policies.
19+
20+
What changes for you: nothing until an object declares `defaultRowScope`. Once one does, a principal whose permission sets carry no row policy for it reads only the rows the default admits. To give such a principal a different scope, put a row policy for the object in a permission set it holds; that policy is then used instead of the default.

‎.changeset/pre/24338-object-default-row-scope.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Clause-②: yes (widening)
1111

1212
- **What it parses.** Every member of `RowLevelSecurityPolicySchema` except `object`, the same member schemas: `name`, `label`, `description`, `operation`, `using`, `check`, `positions` and `enabled` (default `true`). The policy's two rules hold as written: at least one of `using` / `check`, and no `check` on a `select` or `delete` policy.
1313
- **What it refuses.** `object` is refused by name, with a prescription to delete it: the target is implied. Any other unknown key is refused too, the policy's retired `priority` and `tags` included.
14-
- **What it does today: nothing.** No server reads the key in this release, so declaring it filters no rows. The describe states the contract the security plugin's row-policy collection is to meet once it reads the key: the default is to apply when no permission set the caller holds carries a row policy for the object; a policy an authored set carries is to be used as authored; a superuser-bypass principal is to be unaffected; an object without the key keeps its behaviour. No object declares the key yet; the platform's identity objects are to declare it for their own tables. Authoring the key raises the liveness lint's `liveness-planned-property` warning until then. Restrict rows with a permission set's `rowLevelSecurity` policy in the meantime.
14+
- **What it does.** The security plugin's row-policy collection (`collectRLSPolicies`), the one step every read, write and explain passes through, applies the key: when the permission sets the caller holds carry no row policy for the object and the operation (a `'*'` policy counts; one switched off, outside the caller's positions, or for another operation does not), the object's default is used in their place and judged like a held policy. A policy an authored set carries for the object is used as authored, with the default not added to it; a principal whose superuser bypass skips row policies is unaffected; an object without the key keeps its behaviour. A `using` the row-filter compiler cannot lower makes the reads it governs return no rows, with one server warning. The platform's identity objects are to declare it for their own tables in a separate change. See the `@objectstack/plugin-security` entry in this release for the reader.
1515
- **`composeStacks` with `objectConflict: 'merge'`** now refuses two stacks that declare a different `defaultRowScope` on the same object, the way it refuses every other fixed-shape config object (`access`, `enable`, `publicSharing`, …). The refusal message's list of those objects names `defaultRowScope` too. Nothing composed before is affected, because no stack declared the key.
1616
- **`@objectstack/metadata-core`: the field-level-security projection classifies the new key.** When an object document is served to a caller who cannot read some of its fields, `defaultRowScope` is treated like a validation rule: the whole policy is dropped from the served document when its `using`, `check` or prose names a field that caller cannot read, and served unchanged otherwise. No behaviour moves until an object declares the key, and no object declares it yet.
1717
- Additive: every object that parsed before still parses, and its parsed output is unchanged.

‎content/docs/references/api/metadata.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ Metadata query with filtering, sorting, and pagination
969969
| **searchableFields** | `string[]` | optional | Fields the `$search` query matches against (ADR-0061). Canonical default for the record picker, list quick-search and global search; views may narrow it. When unset, search auto-defaults to the name/title field plus short-text fields. Entries must name a STORED column: a virtual `formula` field is computed on read and materializes no column, so searching it can never match and it is refused — mirror the value onto a stored text field and declare that. |
970970
| **enable** | `{ trackHistory?: boolean; searchable?: boolean; apiEnabled?: boolean; apiMethods?: Enum<'get' \| 'list' \| 'create' \| 'update' \| 'delete' \| 'bulk'>[]; … }` | optional | Enabled system features modules |
971971
| **sharingModel** | `Enum<'private' \| 'public_read' \| 'public_read_write' \| 'controlled_by_parent'>` | optional | Org-Wide Default record visibility (OWD) for INTERNAL users. Canonical four only (legacy aliases removed, ADR-0090 D4): private (owner-only) \| public_read (everyone reads, owner writes) \| public_read_write (everyone reads+writes) \| controlled_by_parent (derived from the master record). A CUSTOM object that omits this resolves to private at runtime (ADR-0090 D1). |
972-
| **defaultRowScope** | `{ name: string; label?: string; description?: string; operation: Enum<'select' \| 'insert' \| 'update' \| 'delete' \| 'all'>; … }` | optional | The object's default row scope: one row-level security policy, written like a permission set's `rowLevelSecurity` entry without `object` (the declaring object is implied; writing `object` is refused). The contract the security plugin's row-policy collection, the one step every read, write and explain passes through, is to meet once it reads the key: when no permission set the caller holds carries a row policy for this object, this policy is to apply; a policy an authored set carries for the object is to be used as authored, with this default not added to it; a principal whose superuser bypass skips row policies is to be unaffected; an object that declares none keeps the behaviour it has without the key. The platform's identity objects are to declare it for their own tables. Not applied yet: no server reads this key in this release, so declaring it filters no rows. Until the collection applies it, restrict rows with a permission set's `rowLevelSecurity` policy. |
972+
| **defaultRowScope** | `{ name: string; label?: string; description?: string; operation: Enum<'select' \| 'insert' \| 'update' \| 'delete' \| 'all'>; … }` | optional | The object's default row scope: one row-level security policy, written like a permission set's `rowLevelSecurity` entry without `object` (the declaring object is implied; writing `object` is refused). The security plugin's row-policy collection, the one step every read, write and explain passes through, applies it when no permission set the caller holds carries a row policy for this object and the operation: a held policy for every object (`'*'`) counts, while one for another operation, switched off, or outside the caller's positions does not. A policy an authored set carries for the object is used as authored, with this default not added to it; a principal whose superuser bypass skips row policies is unaffected; an object that declares none keeps the behaviour it has without the key. The default is judged like a held policy: its `operation`, `positions` and `enabled` decide where it applies, and a `using` the row-filter compiler cannot lower makes every read it governs return no rows, with one warning in the server log. Authoring checks do not judge this predicate, so keep it inside the lowerable subset. Explain names an applied default as the object's own, not a permission set's. |
973973
| **externalSharingModel** | `never` | optional | [REMOVED] `object.externalSharingModel` was removed in @objectstack/spec 18 (ADR-0049 enforce-or-remove) — it never had an effect: no request resolves an external principal, and the external rung of the authorization kernel (ADR-0095) admits explicitly shared rows only, never an org-wide default, so the value changed no answer for anyone. Delete the key. `sharingModel` is the one org-wide default; a principal reaches a row it does not own through an explicit share, and an anonymous reader through a share link (`publicSharing`). Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
974974
| **publicSharing** | `{ enabled?: boolean; allowedAudiences?: Enum<'public' \| 'link_only' \| 'signed_in' \| 'email'>[]; allowedPermissions?: Enum<'view' \| 'comment' \| 'edit'>[]; maxExpiryDays?: integer; … }` | optional | Public share-link policy (Notion/Figma-style link sharing) |
975975
| **actions** | `{ name: string; label: string \| Record<string, string>; description?: string \| Record<string, string>; objectName?: string; … }[]` | optional | Actions associated with this object (auto-populated from top-level actions via objectName) |

‎content/docs/references/data/object.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const result = ApiMethod.parse(data);
173173
| **searchableFields** | `string[]` | optional | Fields the `$search` query matches against (ADR-0061). Canonical default for the record picker, list quick-search and global search; views may narrow it. When unset, search auto-defaults to the name/title field plus short-text fields. Entries must name a STORED column: a virtual `formula` field is computed on read and materializes no column, so searching it can never match and it is refused — mirror the value onto a stored text field and declare that. |
174174
| **enable** | `{ trackHistory?: boolean; searchable?: boolean; apiEnabled?: boolean; apiMethods?: Enum<'get' \| 'list' \| 'create' \| 'update' \| 'delete' \| 'bulk'>[]; … }` | optional | Enabled system features modules |
175175
| **sharingModel** | `Enum<'private' \| 'public_read' \| 'public_read_write' \| 'controlled_by_parent'>` | optional | Org-Wide Default record visibility (OWD) for INTERNAL users. Canonical four only (legacy aliases removed, ADR-0090 D4): private (owner-only) \| public_read (everyone reads, owner writes) \| public_read_write (everyone reads+writes) \| controlled_by_parent (derived from the master record). A CUSTOM object that omits this resolves to private at runtime (ADR-0090 D1). |
176-
| **defaultRowScope** | `{ name: string; label?: string; description?: string; operation: Enum<'select' \| 'insert' \| 'update' \| 'delete' \| 'all'>; … }` | optional | The object's default row scope: one row-level security policy, written like a permission set's `rowLevelSecurity` entry without `object` (the declaring object is implied; writing `object` is refused). The contract the security plugin's row-policy collection, the one step every read, write and explain passes through, is to meet once it reads the key: when no permission set the caller holds carries a row policy for this object, this policy is to apply; a policy an authored set carries for the object is to be used as authored, with this default not added to it; a principal whose superuser bypass skips row policies is to be unaffected; an object that declares none keeps the behaviour it has without the key. The platform's identity objects are to declare it for their own tables. Not applied yet: no server reads this key in this release, so declaring it filters no rows. Until the collection applies it, restrict rows with a permission set's `rowLevelSecurity` policy. |
176+
| **defaultRowScope** | `{ name: string; label?: string; description?: string; operation: Enum<'select' \| 'insert' \| 'update' \| 'delete' \| 'all'>; … }` | optional | The object's default row scope: one row-level security policy, written like a permission set's `rowLevelSecurity` entry without `object` (the declaring object is implied; writing `object` is refused). The security plugin's row-policy collection, the one step every read, write and explain passes through, applies it when no permission set the caller holds carries a row policy for this object and the operation: a held policy for every object (`'*'`) counts, while one for another operation, switched off, or outside the caller's positions does not. A policy an authored set carries for the object is used as authored, with this default not added to it; a principal whose superuser bypass skips row policies is unaffected; an object that declares none keeps the behaviour it has without the key. The default is judged like a held policy: its `operation`, `positions` and `enabled` decide where it applies, and a `using` the row-filter compiler cannot lower makes every read it governs return no rows, with one warning in the server log. Authoring checks do not judge this predicate, so keep it inside the lowerable subset. Explain names an applied default as the object's own, not a permission set's. |
177177
| **externalSharingModel** | `never` | optional | [REMOVED] `object.externalSharingModel` was removed in @objectstack/spec 18 (ADR-0049 enforce-or-remove) — it never had an effect: no request resolves an external principal, and the external rung of the authorization kernel (ADR-0095) admits explicitly shared rows only, never an org-wide default, so the value changed no answer for anyone. Delete the key. `sharingModel` is the one org-wide default; a principal reaches a row it does not own through an explicit share, and an anonymous reader through a share link (`publicSharing`). Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
178178
| **publicSharing** | `{ enabled?: boolean; allowedAudiences?: Enum<'public' \| 'link_only' \| 'signed_in' \| 'email'>[]; allowedPermissions?: Enum<'view' \| 'comment' \| 'edit'>[]; maxExpiryDays?: integer; … }` | optional | Public share-link policy (Notion/Figma-style link sharing) |
179179
| **actions** | `{ name: string; label: string \| Record<string, string>; description?: string \| Record<string, string>; objectName?: string; … }[]` | optional | Actions associated with this object (auto-populated from top-level actions via objectName) |

0 commit comments

Comments
 (0)