Add queryable_columns shape allow-list#4531
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4531 +/- ##
===========================================
+ Coverage 32.48% 56.44% +23.96%
===========================================
Files 216 358 +142
Lines 18368 39081 +20713
Branches 6478 10975 +4497
===========================================
+ Hits 5967 22061 +16094
- Misses 12369 16948 +4579
- Partials 32 72 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
bc926d6 to
c7cc9c3
Compare
|
Took a focused pass looking for missed corner-cases in the new allow-list boundary. Two issues worth addressing, plus a docs nit. 1. Same-table subqueries bypass
|
…by the client (#4534) PR #4531 made `queryable_columns` apply to normal shape `where` clauses, but as #4531 (comment) pointed out, sensitive columns could still be accessed via subqueries. Making arbitrary `where` clauses with subqueries secure would require more than a root-table column allow-list: we would also need a table allow-list plus per-table `queryable_columns` for every table referenced by a subquery. However, normal where clauses are supposed to be restricted and only set server-side. There's no need to restrict them at all. The are to restrict is the subset snapshots, where clients can change subset `where` and `order_by`. This PR makes the behavior consistent by allowing any server-defined main `where` clause while keeping `queryable_columns` enforcement for subset `where` and subset `order_by`. It also updates the docs to make this distinction clear too. ## Summary - allow main shape `where` clauses to reference any table column even when `queryable_columns` is set - keep `queryable_columns` enforcement for synced projections, subset `where`, and subset `order_by` - update docs, OpenAPI, and the existing changeset to describe the narrower boundary
Summary
Adds
queryable_columnsas a server-side shape allow-list for columns that may be referenced by shape queries. This decouples the security boundary from thecolumnssync projection, so proxies can strictly control which columns are queryable while still allowing clients to request a narrower synced projection.References security advisory: https://github.com/electric-sql/electric/security/advisories/GHSA-c82q-v86f-c87f
Changes
queryable_columnsshape parameter.where, subset filters/orderings, andcolumnsprojections to queryable columns.queryable_columnswhen nocolumnsprojection is provided.