Postgres Rls Pattern

Use when writing or reviewing Postgres queries in a multi-tenant SaaS where every table row must be scoped to a single organization. Enforces the FORCE ROW LEVEL SECURITY + USING + WITH CHECK triple on every tenant-bound table, and wraps application queries in an `orgQuery(orgId)` helper that sets `app.current_org_id` before each statement. Do NOT use for cross-org system queries such as billing cron jobs or admin panels (those bypass RLS intentionally via the service role); use a service-role query wrapper instead.

aibot88 Updated 6 repo stars

File contents

aibot88/sec_skill_store commit cdb1c1639e

Frequently asked questions

npx get-skill add aibot88/postgres-rls-pattern