Commit b0d7d54
fix(analytics): refuse a non-binding read scope before the ObjectQL engine (#13924)
* wip: objectql read-scope vacancy guard
* fix(analytics): refuse a non-binding read scope before the ObjectQL engine
ObjectQLStrategy merges StrategyContext.getReadScope output straight into the
FilterCondition it hands engine.aggregate, so the scope never reaches
compileScopedFilterToSql — the empty-$nin refusal that compiler carries guards
the NativeSQL path and the /analytics/sql echo only.
Measured against a real engine (driver-sqlite-wasm over driver-sql), a non-RLS
scope provider handing an emptied membership that is constant TRUE in effective
polarity received the whole table on any query this strategy served.
assertReadScopeCannotVacate is exported from read-scope-sql.ts, next to the
compiler whose disposition it matches, and called at both engine-bound merges:
withReadScope and resolveFkAttr. The ruled $in: [] reduction is untouched, so
the live RLS composite still admits exactly the own rows, and neither other
route moves.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 11a64cd commit b0d7d54
4 files changed
Lines changed: 629 additions & 1 deletion
File tree
- .changeset
- packages/services/service-analytics/src
- __tests__
- strategies
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments