LibreChat/packages
Danny Avila 4fdab5ef4d
🥅 chore: Block DB Model APIs That Bypass Isolation (#15663)
* 🔒 chore: Lint Out Three More Model APIs That Bypass Tenant Isolation

Mongoose middleware is the only enforcement point for the tenant-isolation
plugin, and `eslint.config.mjs` already bans the two model APIs known to skip
it — `Model.bulkWrite()` and `Model.collection.*` — precisely because a
downstream guard cannot see them. The driver-level probe review on #15578
surfaced three more in the same class:

- `Model.bulkSave()` derives writes and delegates to `bulkWrite()` without
  running save or query middleware, so the plugin can neither stamp nor scope
  them.
- `Model.watch()` opens a change stream outside query middleware, so it emits
  every tenant's events.
- `Model.estimatedDocumentCount()` reads collection metadata and takes no
  filter, so it always returns the count across every tenant.

None of the first two have a call site today; banning them at lint time closes
the class preventively rather than detecting adoption after the fact, and does
it without the replica-set harness a runtime test for `watch()` would need.

`estimatedDocumentCount()` has exactly one caller, `syncWithMeili`, where a
collection-wide estimate is the quantity wanted: it bounds a full-index sync
and only feeds a progress log, and it runs from `indexSync()` at boot outside
any tenant context. That call carries an inline disable with the reason, in
the same form as the existing `no-restricted-syntax` exemptions.

Verified with a throwaway fixture that all three selectors fire alongside the
existing `bulkWrite` control (4 errors), and that `packages/data-schemas`
lints clean under the new config.

* chore: Enforce Tenant API Bans Across Backend Workspaces 🥅

* chore: Preserve Shared Bans in the Bulk-Write Wrapper 🥅
2026-09-06 16:00:37 -04:00
..
api 📫 fix: Surface Sandbox Artifact Delivery Failures (#15671) 2026-09-06 15:31:19 -04:00
client 🧰 feat: Unify Tool Activity, Reasoning, Search, and Agent Workflows (#14546) 2026-09-06 14:56:50 -04:00
data-provider 🗓️ fix: Refresh the Sidebar When a Scheduled Run Fires or Settles (#15631) 2026-09-06 15:28:11 -04:00
data-schemas 🥅 chore: Block DB Model APIs That Bypass Isolation (#15663) 2026-09-06 16:00:37 -04:00