Glossary

Row-level security (RLS)

Database-enforced rules on which rows a user can read or write.

Row-level security (RLS) moves authorization into the database itself: Postgres evaluates a policy on every row for every query, so a user can only ever read or write rows the policy permits. The check happens below the application, not inside it.

This matters for multi-tenant products. If isolation is enforced only in application code, a single missing filter in one query can leak another tenant's data. With RLS, that same bug returns nothing, because the database refuses the rows regardless of what the application asked for.

RLS pairs with a security-definer function for controlled public writes: anonymous respondents have no direct insert policy, and submissions flow through a single vetted function that validates input before writing. Defence in depth - the policy is the backstop, not the only line.

← Back to the glossary · or build a form free.