mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 14:11:13 -05:00
Fix notification view security
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
-- Fix: Remove SECURITY DEFINER from notification_health_dashboard view
|
||||||
|
|
||||||
|
-- Drop and recreate view without SECURITY DEFINER
|
||||||
|
DROP VIEW IF EXISTS public.notification_health_dashboard;
|
||||||
|
|
||||||
|
CREATE VIEW public.notification_health_dashboard
|
||||||
|
WITH (security_invoker = true) AS
|
||||||
|
SELECT
|
||||||
|
date,
|
||||||
|
total_attempts,
|
||||||
|
duplicates_prevented,
|
||||||
|
prevention_rate,
|
||||||
|
CASE
|
||||||
|
WHEN prevention_rate > 10 THEN 'critical'
|
||||||
|
WHEN prevention_rate > 5 THEN 'warning'
|
||||||
|
ELSE 'healthy'
|
||||||
|
END as health_status
|
||||||
|
FROM public.notification_duplicate_stats
|
||||||
|
ORDER BY date DESC
|
||||||
|
LIMIT 30;
|
||||||
Reference in New Issue
Block a user