Skip to content

Commit 3a4ddd5

Browse files
committed
fix(spec): say the CLI authoring checks judge an object's defaultRowScope predicate
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6F9axfoPzR7t8G1J7Ytzz
1 parent fc020c4 commit 3a4ddd5

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎.changeset/24452-default-row-scope-lint.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
"@objectstack/lint": patch
3+
"@objectstack/spec": patch
34
---
45

56
fix(lint): the RLS predicate and org-axis rules judge an object's `defaultRowScope`
@@ -9,3 +10,4 @@ Clause-②: no
910
- **What changed.** `validateRlsPredicateEnforceability` now judges `objects[].defaultRowScope.using` and `.check` with the same passes it runs on a permission set's `rowLevelSecurity[]` policy, with the declaring object as the target. A default whose predicate does not lower, does not parse, overruns a parse bound, names a column the object does not declare, reads a `current_user` key nothing resolves, or (for a `select` / `all` read scope) is refused by the engine's filter admission is reported under the same id, at the same `error` severity, at `objects[N].defaultRowScope.<clause>`. `validateOrgAxisRedLines` rule ① (`org-axis-permission-inheritance`) also judges a default that reads `parent_organization_id`.
1011
- **A new authoring-time finding on a shape that was silent.** Until now these rules walked `permissions[].rowLevelSecurity[]` only, so `os validate`, `os build` and `os lint` passed such a default. The security plugin's row-policy collection hands an object's default to the same compiler an authored policy reaches, so a predicate that does not lower is dropped at request time and the object reads as zero rows for every caller the default applies to. A stack that declares such a default now fails these commands; the fix is the same rewrite the finding prescribes for a permission-set policy. A default that lowers, and an object with no default, report nothing new.
1112
- **How the finding reads.** `where` names the default and its object (`default row scope "NAME" of object "OBJECT"`), never a permission set. `os explain` for the RLS predicate ids now says what a dropped `using` does for both sources: a permission set's policy denies the holders of that set, and a default, applied only when the caller's sets carry no row policy for the object and operation, denies every caller it applies to.
13+
- **The key's own text.** `ObjectSchema.defaultRowScope`'s description said authoring checks do not judge its predicate; it now says `os validate`, `os build` and `os lint` judge it as they judge a permission set's policy, and that saving the object through the server does not run that check.

‎packages/spec/src/data/object.zod.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,8 +2990,10 @@ const ObjectSchemaBase = strictObject(
29902990
*
29912991
* A `using` the row-filter compiler cannot lower is dropped with the
29922992
* compiler's WARN and fails closed to zero rows, exactly as an authored
2993-
* policy's does; the authoring lint (`RLS_PREDICATE_UNENFORCEABLE`) walks
2994-
* permission sets only and does not judge this key. Explain names an applied
2993+
* policy's does. The CLI authoring lint judges this key as it judges a
2994+
* permission set's policy (`RLS_PREDICATE_UNENFORCEABLE` and its sibling
2995+
* ids, #24452); the runtime publish gate runs that rule on `permission`
2996+
* writes only, so an `object` save is not judged there. Explain names an applied
29952997
* default as the object's own declaration, with its `label` and
29962998
* `description`. The writers are to be the platform identity objects
29972999
* (#24341); no object in this tree declares the key yet.
@@ -3007,9 +3009,10 @@ const ObjectSchemaBase = strictObject(
30073009
+ 'bypass skips row policies is unaffected; an object that declares none keeps the behaviour it has '
30083010
+ 'without the key. The default is judged like a held policy: its `operation`, `positions` and `enabled` '
30093011
+ 'decide where it applies, and a `using` the row-filter compiler cannot lower makes every read it '
3010-
+ 'governs return no rows, with one warning in the server log. Authoring checks do not judge this '
3011-
+ 'predicate, so keep it inside the lowerable subset. Explain names an applied default as the object\'s '
3012-
+ 'own, not a permission set\'s.',
3012+
+ 'governs return no rows, with one warning in the server log. `os validate`, `os build` and `os lint` '
3013+
+ 'judge this predicate as they judge a permission set\'s policy and report one that cannot lower; saving '
3014+
+ 'the object through the server does not run that check, so keep it inside the lowerable subset. Explain '
3015+
+ 'names an applied default as the object\'s own, not a permission set\'s.',
30133016
),
30143017

30153018
/**

0 commit comments

Comments
 (0)