Files
thrilltrack-explorer/supabase/migrations/20251107044746_d2d30465-685b-432a-a6ca-b2b8e46935b9.sql
gpt-engineer-app[bot] a74b8d6e74 Fix: Implement pipeline error handling
Implement comprehensive error handling and robustness measures across the entire pipeline as per the detailed plan. This includes database-level security, client-side validation, scheduled maintenance, and fallback mechanisms for edge function failures.
2025-11-07 04:50:17 +00:00

18 lines
543 B
SQL

-- Phase 1: Critical Security Fixes for Sacred Pipeline
-- Fix 1.1: Attach ban prevention trigger to content_submissions
CREATE TRIGGER prevent_banned_submissions
BEFORE INSERT ON content_submissions
FOR EACH ROW
EXECUTE FUNCTION prevent_banned_user_submissions();
-- Fix 1.2: Add RLS policy to prevent banned users from submitting
CREATE POLICY "Banned users cannot submit"
ON content_submissions
FOR INSERT
TO authenticated
WITH CHECK (
NOT EXISTS (
SELECT 1 FROM profiles
WHERE user_id = auth.uid() AND banned = true
)
);