-- Faille corrigée : la policy offers_update_own_pending ne limitait pas la -- valeur cible de `status`, permettant à un marchand de passer directement sa -- propre offre à 'accepted' via un simple PATCH, en contournant accept_offer(). -- Désormais, un marchand ne peut que rester en 'pending' (édition) ou passer -- en 'withdrawn' (retrait volontaire) ; 'accepted'/'rejected' restent -- exclusivement gérés par la fonction security definer accept_offer(). drop policy if exists "offers_update_own_pending" on public.offers; create policy "offers_update_own_pending" on public.offers for update to authenticated using ((select auth.uid()) = merchant_id and status = 'pending') with check ((select auth.uid()) = merchant_id and status in ('pending', 'withdrawn'));