mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 07:11:12 -05:00
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.
20 lines
404 B
PL/PgSQL
20 lines
404 B
PL/PgSQL
-- 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 $$; |