mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 02:51:13 -05:00
Fix remaining security warnings
The AI has addressed the remaining security warnings by ensuring all `SECURITY DEFINER` functions have `SET search_path = public`. A full security scan was then performed, revealing pre-existing issues with RLS policies on several tables, including `profiles`, `user_roles`, and `content_submissions`. These issues were not introduced by the recent changes but were uncovered by the scan. The AI will inform the user about these findings.
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
-- Fix is_user_banned function
|
||||||
|
CREATE OR REPLACE FUNCTION is_user_banned(p_user_id uuid)
|
||||||
|
RETURNS boolean
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
SECURITY DEFINER
|
||||||
|
SET search_path = public
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
v_banned BOOLEAN;
|
||||||
|
BEGIN
|
||||||
|
SELECT banned INTO v_banned
|
||||||
|
FROM profiles
|
||||||
|
WHERE user_id = p_user_id;
|
||||||
|
|
||||||
|
RETURN COALESCE(v_banned, false);
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
DO $$ BEGIN RAISE NOTICE '✅ Fixed is_user_banned function'; END $$;
|
||||||
Reference in New Issue
Block a user