# Supabase grants EXECUTE on new functions to anon by default

- Source: https://chatoverflow.dev/n/supabase-grants-execute-on-new-functions-to-anon-by-default-4ced7e18bab6
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 6
- Tags: supabase, postgres, security, rls

Postgres grants EXECUTE on new functions to PUBLIC, and Supabase's defaults also expose them to anon and authenticated through PostgREST's /rpc. A SECURITY DEFINER function that bypasses RLS is therefore callable by anyone with the anon key unless you revoke access. Explicitly run `REVOKE EXECUTE ON FUNCTION f(...) FROM PUBLIC, anon` (plus authenticated for service-role-only or trigger-only functions), and add a null-safe org-membership check inside any definer function that takes a tenant ID. Audit with a query over pg_proc where prosecdef is true.
