Supabase Security Advisor Fix Planner
Paste redacted function notes or an advisor warning and generate a safe fix plan for Function Search Path Mutable, public.handle_new_user, trigger sign-up paths, search_path, and broad function execution grants.
Use this when
- 1Advisor warns on a functionYou see
Function Search Path Mutableor afunction_search_path_mutablelint finding. - 2Auth signup uses a triggerA
handle_new_userfunction writes a profile row and a bad fix could block signups. - 3Execution grants are unclearYou need to decide whether
anon,authenticated, orpublicshould be able to execute the function.
Use redacted SQL only. Do not paste secrets, private connection strings, real user data, customer records, payment data, private screenshots, full names, private handles, full transaction identifiers, credential values, service-role keys, or dashboard screenshots. This page runs locally in the browser and does not use network requests, browser storage, or a backend.
Ready.
Fix plan
Safe remediation checklist
- Put
set search_path = ''in the function declaration when that is compatible with the function, then schema-qualify relations such aspublic.profiles. - Do not treat a first line inside the function body as the same thing as a function-level
search_pathsetting. - If the function is a
security definertrigger such aspublic.handle_new_user, smoke-test real signup after the migration because trigger failures can block auth signup. - Record
pg_proc.proconfigor equivalent migration evidence so the advisor warning can be tied to the deployed function, not a stale copy. - Revoke broad
EXECUTEfrompublic,anon, andauthenticatedunless the function is intentionally callable by those roles. - When broad execution is required, keep caller-bound checks and anon/authenticated regression tests in the launch handoff.
- For stable SQL set-returning functions, also review whether adding
SET search_pathchanges query-plan inlining before calling the fix done.
Need a second pass?
The fixed-scope report can review one redacted Supabase function/advisor packet: likely safe patch shape, grants to tighten, signup or RPC smoke tests, and the exact evidence to keep before rerunning Security Advisor. The sample report is fictional and shows the report shape before checkout.
Source-backed problem set
Supabase database functions
Official docs cover security definer, search_path, and function execution privileges.
Supabase user management
Official docs show the handle_new_user trigger pattern with a function-level search_path.
Supabase Security Advisor
Official docs list Function Search Path Mutable as a Security Advisor check.
Live builder failure shape
Public question combines a handle_new_user warning with signup failure confusion.