Skip to content

Commit 47eeb7a

Browse files
Fix Supabase security warnings
1 parent dae5726 commit 47eeb7a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Fix security warning: Set search_path for handle_new_user function
2+
CREATE OR REPLACE FUNCTION public.handle_new_user()
3+
RETURNS TRIGGER AS $$
4+
BEGIN
5+
INSERT INTO public.profiles (id, email, display_name)
6+
VALUES (
7+
NEW.id,
8+
NEW.email,
9+
COALESCE(NEW.raw_user_meta_data->>'display_name', NEW.email)
10+
);
11+
RETURN NEW;
12+
END;
13+
$$ LANGUAGE plpgsql SECURITY DEFINER SET search_path = public;

0 commit comments

Comments
 (0)