Row-Level Security (RLS)

Row-level security (RLS) is a database feature that restricts which rows a user can read or modify using policies enforced by the database on every query.

With RLS, you attach policies to a table. Each policy is a SQL expression that decides which rows are visible or writable for the current user. Once enabled, the database applies it automatically to every query.

RLS is the foundation of secure multi-tenancy and per-user access. A single policy keyed on a tenant or owner column guarantees isolation no matter which client — API, SQL console, or background job — runs the query.

Because the rule lives in the database, you define access control once instead of re-checking it in every endpoint, eliminating a whole class of data-leak bugs.

Related terms

Row-Level Security in basefyio

See it in practice

basefyio gives you database, auth, storage, and a REST API in minutes.

Get started