Developer Utility

PostgreSQL RLS Policy Generator

Row Level Security (RLS) is notoriously easy to get wrong. Select a standard access pattern to generate secure, battle-tested Postgres policies for your tables. Optimized for Supabase.

1. Table Configuration

2. Access Pattern

generated-policy.sql
-- 1. Enable Row Level Security (Required)
ALTER TABLE "public"."posts" ENABLE ROW LEVEL SECURITY;

-- 2. Policy: Users can only manage their own data
CREATE POLICY "Users can manage their own data"
ON "public"."posts"
FOR ALL
TO authenticated
USING ( auth.uid() = user_id )
WITH CHECK ( auth.uid() = user_id );

Already have policies?

Writing RLS is only half the battle. DBXray automatically scans your entire schema to find logic bypasses, permissive policies, and over-privileged roles.

Scan your database