@smithers-orchestrator/electric-proxy 0.25.1 → 0.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithers-orchestrator/electric-proxy",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "description": "Auth, scope, rate-limit, and observability proxy for Smithers ElectricSQL Shapes",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,7 +24,7 @@
24
24
  "bin/"
25
25
  ],
26
26
  "dependencies": {
27
- "@smithers-orchestrator/gateway": "0.25.1"
27
+ "@smithers-orchestrator/gateway": "0.25.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/bun": "latest",
@@ -300,6 +300,19 @@ function validateWhere(
300
300
  auth: SmithersElectricAuthContext,
301
301
  ): string | null {
302
302
  const unscoped = auth.unscoped === true;
303
+ // A shape with no row-level scoping mechanism at all (no run/workspace/user
304
+ // column AND no whereTemplate) is a whole-table read. Forwarding it to a
305
+ // scoped principal (e.g. a `run:read` token granted a single run) would
306
+ // expose every row of the table regardless of which runs were granted — the
307
+ // exact fail-open the rest of this module is designed to prevent. Reject it
308
+ // before any client-supplied `where` is considered; only an explicitly
309
+ // unscoped principal (a single-user local-cloud install) may read it.
310
+ const hasRowScoping = Boolean(
311
+ shape.runIdColumn || shape.workspaceIdColumn || shape.userPrivateColumn || shape.whereTemplate,
312
+ );
313
+ if (!hasRowScoping && !unscoped) {
314
+ throw new Error(`shape "${shape.name}" has no row-level scoping and cannot be served to a scoped principal`);
315
+ }
303
316
  const effectiveWhere = where && where.trim() ? where.trim() : fillWhereTemplate(shape, auth);
304
317
  if (!effectiveWhere) {
305
318
  // No client where and the template could not be filled. For a scoped shape