Prevents CPU spikes and full table scans from poorly written RLS policies via index and wrapper enforcement.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
auth.uid(), auth.jwt(), or auth.role() call inside a USING or WITH CHECK expression MUST be wrapped in a subselect: (SELECT auth.uid()). Unwrapped calls force re-evaluation per row and cause full table scans.SECURITY DEFINER function. Inline multi-table JOINs in policies create unpredictable query plans and lock escalation.idx_{table}_{column}_rls.SECURITY DEFINER functions with SET search_path = public to prevent search_path injection.IF NOT EXISTS on all CREATE INDEX statements to ensure idempotency.EXPLAIN ANALYZE after applying changes.SECURITY DEFINER functions that accept arbitrary SQL or text input.