fix(rls): make tenant-isolation GUC count symmetric with owner count #320
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-437-rls-isolation-internal-count-symmetry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-414 changed the matching-GUC assertion in rls_isolation to compare against a dynamically captured owner-visible count (tenant_a_companies), which counts every tenant-A company including the internal own-company that PMS-413 migration 062 backfills. Independently, PMS-413 had added a
WHERE company_type <> 'internal'filter to the GUC-side count. Merged together these two predicates are asymmetric: the owner count is 2 (probe + internal own-company) while the filtered GUC count is 1, so the assertion fails even though RLS is behaving correctly.RLS filters purely by tenant_id, not company_type, so the matching GUC legitimately exposes every tenant-A row including the internal own-company (the test comment already states all of these rows must be visible under the matching GUC). Drop the leftover
<> 'internal'filter from the GUC count so both sides count the same set; the test still proves fail-closed reads and exact tenant-A visibility.#PMS-437