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:
gpt-engineer-app[bot]
2025-11-07 04:50:17 +00:00
parent 03aab90c90
commit a74b8d6e74
9 changed files with 513 additions and 64 deletions

View File

@@ -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
)
);