@davoodmehraban89 / Factor-easy / commits / f2d2ae4
Fork 0

سامانه صدور فاکتور و حسابداری

Archive SECURITY DEFINER RPC hardening migration

davoodmehraban89 committed Sep 30, 2026 at 07:48 UTC f2d2ae4b2710c383d017a51c6475d1f33a028db3
1 file changed +23
supabase/migrations/20260930041735_harden_public_security_definer_rpc_grants_search_path.sql new
+23
@@ -0,0 +1,23 @@
1 +alter function public.admin_cancel_license(uuid) set search_path = '';
2 +alter function public.admin_extend_license(uuid, integer) set search_path = '';
3 +alter function public.admin_set_company_limit(uuid, integer) set search_path = '';
4 +alter function public.admin_set_license(uuid, text, integer, text) set search_path = '';
5 +alter function public.admin_set_license_modules(uuid, text[]) set search_path = '';
6 +alter function public.has_active_license() set search_path = '';
7 +alter function public.is_admin() set search_path = '';
8 +
9 +revoke execute on function public.admin_cancel_license(uuid) from public, anon;
10 +revoke execute on function public.admin_extend_license(uuid, integer) from public, anon;
11 +revoke execute on function public.admin_set_company_limit(uuid, integer) from public, anon;
12 +revoke execute on function public.admin_set_license(uuid, text, integer, text) from public, anon;
13 +revoke execute on function public.admin_set_license_modules(uuid, text[]) from public, anon;
14 +revoke execute on function public.has_active_license() from public, anon;
15 +revoke execute on function public.is_admin() from public, anon;
16 +
17 +grant execute on function public.admin_cancel_license(uuid) to authenticated, service_role;
18 +grant execute on function public.admin_extend_license(uuid, integer) to authenticated, service_role;
19 +grant execute on function public.admin_set_company_limit(uuid, integer) to authenticated, service_role;
20 +grant execute on function public.admin_set_license(uuid, text, integer, text) to authenticated, service_role;
21 +grant execute on function public.admin_set_license_modules(uuid, text[]) to authenticated, service_role;
22 +grant execute on function public.has_active_license() to authenticated, service_role;
23 +grant execute on function public.is_admin() to authenticated, service_role;