mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 05:31:16 -05:00
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.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- 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
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user