Cross-Tenant Row-Level Security Permission Leakage
An authenticated user belonging to Group A could read expense records from Group B by supplying foreign record UUIDs directly to the query client.
The initial Supabase RLS SELECT policy only validated that the requesting user was authenticated (auth.role() = "authenticated"), neglecting to enforce group membership scoping on individual expense row reads.
Wrote a failing reproduction query, discarded the loose policy, and authored a scoped subquery constraint requiring auth.uid() IN (SELECT user_id FROM group_memberships WHERE group_id = expenses.group_id). Reverified with automated integration assertions.
Client-side UI scoping is purely cosmetic. Tenant isolation must be physically locked at the database query planner level.