feat(security): ADR-0058 D1 follow-through — RLS predicates migrate to canonical CEL#2099
Merged
Conversation
…o canonical CEL The expression surface now speaks ONE language. Migrate every seeded RLS `using`/`check` from the legacy SQL-ish dialect (`=`, `IN (...)`) to pure CEL (`==`, `in`): - default-permission-sets.ts (49) + app-showcase (2): all owner/tenant/self policies are CEL. - rls.zod.ts RLS.ownerPolicy/tenantPolicy/allowAllPolicy helper factories now emit CEL templates; doc examples updated to match. The `sqlPredicateToCel` bridge is downgraded to a DEPRECATED transitional shim: compileExpression warns when it actually rewrites a SQL-style predicate, so authored policies migrate, while stored/legacy SQL still compiles (no silent deny on existing data). The bridge is IDEMPOTENT on CEL input, so the migrated seeds pass through as no-ops with no warn. No runtime behavior change: CEL and the old SQL form compile to the identical FilterCondition (verified). New tests prove the bridge (SQL still compiles + warns; CEL is silent). Green: spec 6599, plugin-security 122, plugin-sharing 65, formula 201, dogfood 130. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 89 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 21, 2026
…le examples (#2113) After "RLS using → canonical CEL" (#2099) the docs/skills still taught the old SQL-ish grammar — which now misleads AI authors (the skills/docs were lying relative to main). Fix: - skills/objectstack-data/SKILL.md: drop "restricted grammar (not arbitrary CEL): field = current_user.x, IN(...), 1=1" — RLS predicates are now canonical CEL (==, in, comparisons, &&/||/!, == null), no subqueries/cross-object (compile error, ADR-0055); legacy SQL still compiles via the deprecated bridge. - protocol/objectql/security.mdx: "SQL-like" → CEL; all using/check examples to CEL; and fix three examples that NEVER compiled — an `IN (SELECT …)` subquery, a `current_user.region` (a non-exposed variable), and a `NOW()`/`AND` time window (functions aren't pushdown-able) — replaced with pre-resolved §7.3.1 membership sets / honest "do it in the app layer" notes. - guides/security.mdx, guides/metadata/permission.mdx, concepts/implementation- status.mdx: `=`/`IN` → `==`/`in` in prose + examples. Doc/skill-only. check:skill-docs in sync; no runtime change. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-through on ADR-0058 D1 ("one expression language, one compiler"). After the compiler landed (#2090), this retires the second dialect on the RLS surface.
What changed
RLS
using/checkpredicates were SQL-ish (owner_id = current_user.id,IN (...)) while sharing conditions were CEL. AI/authors had to learn two dialects and the runtime carried asqlPredicateToCelbridge. Now every seeded RLS predicate is pure CEL:default-permission-sets.ts(49) +app-showcase(2): all owner/tenant/self policies → CEL (==,in).rls.zod.tsRLS.ownerPolicy/tenantPolicy/allowAllPolicyhelper factories now emit CEL templates; doc examples updated.The bridge is kept, but deprecated (deliberate)
sqlPredicateToCelis not deleted — it's downgraded to a transitional shim.compileExpressionnow warns only when it actually rewrites a SQL-style predicate; canonical CEL passes through as a no-op (idempotent), so the migrated seeds emit no warning. Rationale: a stored/legacy SQL predicate in asystable must keep compiling — hard-deleting the bridge would turn it into a silent deny, which is exactly the kind of invisible security regression we refuse. The bridge gets removed pre-launch once we confirm no stored predicate needs it.No behavior change
CEL and the old SQL form compile to the identical
FilterCondition— verified by re-running every RLS seed throughisPushdownableCeland the full runtime dogfood. New tests prove the bridge both ways (SQL still compiles + warns; CEL is silent).Verification (local, all green)
spec 6599 · plugin-security 122 · plugin-sharing 65 · formula 201 · dogfood 130 (full).
🤖 Generated with Claude Code