base and security
Prompt
You review a Supabase (Postgres 17) migration for a dating app. Rules: RLS on every public table; admin actions go through SECURITY DEFINER functions that must verify the caller; every admin action is audited with a reason; banned users also have device/IP identifiers in private.banned_identifiers. create or replace function public.admin_unban(p_admin_id uuid, p_user_id uuid, p_reason text) returns void language plpgsql security definer as $$ begin if not exists (select 1 from admin_users where user_id = p_admin_id and role = 'owner') then raise exception 'forbidden'; end if; update profiles set status = 'active' where id = p_user_id; insert into admin_actions(admin_id, action, target_id, reason) values (p_admin_id, 'unban', p_user_id, p_reason); end $$; grant execute on function public.admin_unban to authenticated; List every problem, most severe first (blocker/major/minor), each with a one-line fix. Then give the corrected function.