Fix security vulnerability
This commit is contained in:
@ -44,7 +44,7 @@ const Index = () => {
|
||||
|
||||
const fetchSignatureCount = async () => {
|
||||
const { count } = await supabase
|
||||
.from('petition_signatures')
|
||||
.from('petition_signatures_public')
|
||||
.select('*', { count: 'exact', head: true });
|
||||
|
||||
setSignatureCount(count || 0);
|
||||
|
||||
@ -47,16 +47,16 @@ const Testimonies = () => {
|
||||
|
||||
const fetchSignatures = async () => {
|
||||
try {
|
||||
// Get total count
|
||||
// Get total count from public view (emails hidden)
|
||||
const { count } = await supabase
|
||||
.from('petition_signatures')
|
||||
.from('petition_signatures_public')
|
||||
.select('*', { count: 'exact', head: true });
|
||||
|
||||
setTotalCount(count || 0);
|
||||
|
||||
// Get signatures with comments
|
||||
// Get signatures with comments from public view (emails hidden)
|
||||
const { data, error } = await supabase
|
||||
.from('petition_signatures')
|
||||
.from('petition_signatures_public')
|
||||
.select('*')
|
||||
.not('comment', 'is', null)
|
||||
.order('created_at', { ascending: false });
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
-- Fix the security definer view by enabling security invoker mode
|
||||
-- This ensures the view respects RLS policies of the querying user
|
||||
ALTER VIEW public.petition_signatures_public SET (security_invoker = on);
|
||||
Reference in New Issue
Block a user