whatsapp-mcp / db/scoped / SCOPED_QUERIES_PLACEHOLDER
Variable: SCOPED_QUERIES_PLACEHOLDER
const SCOPED_QUERIES_PLACEHOLDER: true = true;Defined in: src/db/scoped.ts:29
File
The only module allowed to issue queries against tenant tables.
Trust
internal
No-log
clientId may appear in error metadata but never the resolved rows in error messages.
Remarks
This file is a deliberate Phase-4 placeholder. The full set of scoped query helpers lands when the auth pipeline is wired up — until then the file exists so:
- The ESLint rule that forbids raw
pool.queryagainst tenant tables outsidesrc/db/scoped.tshas a definite path to point at, and - Any developer reaching for a
WHERE client_id = ...query in another module immediately sees that this is the canonical home.
The contract (filled in by Phase 4) is:
- Every exported function takes
clientId: stringas its first argument. - Every function injects
WHERE <table>.client_id = $1(or equivalent via join) before any caller-suppliedwhereclause. - Cross-tenant isolation tests in CI assert client B cannot read/write client A’s rows via any exported function here.
See
docs/plan/architecture.md §1 — Row-level isolation strategy