You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(db): 10 functions from migrations 314-325 have no search_path #468
308_function_search_path.sql gives every owned function in core/data/community/onet/public an explicit search_path (Supabase advisor #172). But 10 functions have none, because they were created by migrations 314–325 — i.e. after 308 ran. They were never covered, in either 308's original form or the fixed one.
selectcount(*) from pg_proc p join pg_namespace n onn.oid=p.pronamespacewheren.nspnamein ('core','data','community','onet','public') andp.prokind='f'andp.proowner= (selectoidfrom pg_roles where rolname =current_user)
and not exists (select1from unnest(coalesce(p.proconfig,'{}')) c where c like'search_path=%');
-- 10
Mostly trigger functions plus core.tasks_handle_completion, so the practical risk is low today — but a positional sweep migration is inherently a one-shot fix, and anything added after it drifts out of compliance silently.
Suggested fix: rather than another positional sweep that will go stale the same way, add the search_path to each function's own definition, and/or add a CI check asserting the count above is zero so a new function without one fails the build.
Note #442 changed 308 to preserve declared search_paths instead of overwriting them, so re-running it is now safe — but it still only covers functions that exist when it runs.
Fixed. The issue's own verification query returns 0 on a current local database:
selectcount(*) from pg_proc p join pg_namespace n onn.oid=p.pronamespacewheren.nspnamein ('core','data','community','onet','public') andp.prokind='f'andp.proowner= (selectoidfrom pg_roles where rolname =current_user)
and not exists (select1from unnest(coalesce(p.proconfig,'{}')) c where c like'search_path=%');
-- 0
All ten named functions now carry an explicit search_path, including the community.* set from migrations 314–325 and core.tasks_handle_completion.
Worth noting for anyone adding a SECURITY DEFINER function later: 308 only covered what existed when it ran, so this class of gap reappears with every new definer function unless the migration sets search_path itself. Migration 349 (#703) does.
Activity
fix(db): grant service_role the eight tables it could not read, and s…
thinkclay commentedon Sep 10, 2026
Fixed. The issue's own verification query returns 0 on a current local database:
All ten named functions now carry an explicit
search_path, including thecommunity.*set from migrations 314–325 andcore.tasks_handle_completion.Worth noting for anyone adding a
SECURITY DEFINERfunction later: 308 only covered what existed when it ran, so this class of gap reappears with every new definer function unless the migration setssearch_pathitself. Migration 349 (#703) does.fix(db): grant service_role the eight tables it could not read, and s…