Supabase RLS helper functions exposed via the API can be moved to a private schema
A developer found that SECURITY DEFINER helper functions used by Supabase row-level security policies sat in the public schema, making them callable through the Data API. Before relocating them, they mapped every policy, function, and app call that depended on the helpers. The fix moves the functions to a private schema with restricted usage and keeps EXECUTE granted only to authenticated users so policies still work. Tests across three permission states confirmed that policies kept functioning while direct RPC calls returned not-found or permission errors. The author also noted that the private schema must be excluded from the exposed Data API schemas in project settings.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in