feat: mobile-first refactor for BottleDetails & RLS security/performance optimizations
This commit is contained in:
31
security_search_path_fix.sql
Normal file
31
security_search_path_fix.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- ============================================
|
||||
-- Database Security Optimization: Search Path
|
||||
-- ============================================
|
||||
-- Addresses "function_search_path_mutable" security warnings
|
||||
-- ============================================
|
||||
|
||||
-- Fix for handle_new_user
|
||||
ALTER FUNCTION public.handle_new_user() SET search_path = '';
|
||||
|
||||
-- Fix for generate_buddy_code
|
||||
-- If this function exists, update its search_path
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM pg_proc WHERE proname = 'generate_buddy_code') THEN
|
||||
ALTER FUNCTION public.generate_buddy_code() SET search_path = '';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Fix for check_session_access
|
||||
-- If this function exists, update its search_path
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM pg_proc WHERE proname = 'check_session_access') THEN
|
||||
BEGIN
|
||||
ALTER FUNCTION public.check_session_access(uuid) SET search_path = '';
|
||||
-- Note: If it has different arguments, you might need to adjust the signature above
|
||||
EXCEPTION WHEN OTHERS THEN
|
||||
RAISE NOTICE 'Could not set search_path for check_session_access: %', SQLERRM;
|
||||
END;
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user