Skip to content

RLS policies are admitted when they are authored: policy save and objectstack validate / compile judge the lowered read-scope filter with the engine's judge-only method (objectstack#19995 ruling C, second consumer) #20158

Description

@objectstack-fleet

Blocked-by: #20157

Filed by the director seat from the maintainer's ruling on #19995 (batch #225 item 3, letter C, 「同意」, which includes this second consumer). Reader who acts: the domain:services execution seat (plugin-security owns policy admission); the objectstack validate / compile half lives in packages/cli, so if one PR cannot carry both the seat claims under the cross-domain exception path and triage designates, or the CLI half becomes a sub-issue. area:* is left for triage. ⛔ Not a claim. Dedupe: #19995's semantic search (42 hits) and the open domain:services titles carry no authoring-time policy admission card.

Why

ADR-0058 D2 already rules that a predicate on a compile surface (RLS using / check, sharing condition, the analytics read scope) that the compiler cannot lower is an authoring-time compile error, never a silent drop. The four classes #19995 still leaks (a text operator over a non-text field, an uninterpretable temporal comparand, a filter on a virtual field, a dotted path through a lookup) and the eleven it already withholds are all decidable from the object schema at authoring time; today they surface only when a query runs, on the analytics face as a policy-echoing 400. Every mainstream row-level-security implementation admits the policy when it is written: PostgreSQL at CREATE POLICY, SQL Server at CREATE SECURITY POLICY (schema-bound predicates), Hasura when metadata is applied, IAM and Firebase rules at save or deploy. The runtime withheld 500 (#5367) stays as the backstop.

Work

  1. After Seam: IObjectQLEngine gains an optional judge-only filter-admission method, run by the engine's own admission pipeline without executing (objectstack#19995 ruling C) #20157 lands: the RLS policy save path in plugin-security (the consumer of the CEL → FilterCondition lowering) and objectstack validate / compile (defineStack) call the engine's judge-only method on the lowered read-scope filter for the policy's object, and refuse the policy with the engine's diagnostic — loud, to the admin or author, naming field, operator and comparand (they are the author's own text here).
  2. Coverage: the fifteen classes named on security: the analytics ObjectQL execute face answers a row-level read scope it cannot run with INVALID_FILTER / 400 whose message echoes the policy's field name and comparands — the disclosure #5367 closed for the native / echo faces #19995 (the eleven PR fix(service-analytics): the ObjectQL execute face refuses an unrunnable read scope in the withheld READ_SCOPE_COMPILE_FAILED / 500 envelope #20017 / fix(service-analytics)!: the NativeSQL execute face and the /analytics/sql echo refuse a read scope the shared comparand faces refuse #20046 / fix(service-analytics): the ObjectQL face refuses a read scope carrying a placeholder the engine cannot resolve in the withheld READ_SCOPE_COMPILE_FAILED / 500 envelope (#19995) #20072 withhold at the merge boundary and the four ruling C adds) each get an authoring-time pin: the policy is refused at save / validate with the door's code.
  3. Host-supplied scopes (not authored) are out of scope here; they stay behind the runtime withhold.
  4. Changeset patch for the touched packages unless a published error code is added (then minor); Clause-② per the diff.

Governing text: ADR-0058 D2; the #5367 ruling as recorded in packages/services/service-analytics/src/read-scope-sql.ts; ADR-0021 D-C.

Dedupe words: RLS policy authoring-time admission engine judge · validate compile read scope policy refused at save · ADR-0058 D2 policy compile error 19995

Director seat · session_01AsCNgFBs8HCjwhyHQsFbx3 · filed from the ruling on #19995


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions