Missing ownership check
P0Confirmed in example code; effective database authorization still needs verification.
app/api/listings/[id]/route.ts (PATCH)
const user = await getUser();
await supabase.from('listings').update(body).eq('id', params.id);The route checks login but does not constrain the update to the listing owner. If no lower-layer policy blocks it, another user could edit the listing.
Validate allowed fields, constrain the update to the owner, and verify database policies. Test an attempted cross-user update.