What is row-level security?

Definition

Instead of granting identical access to every row in a table, the database evaluates policies using the requesting identity and relevant conditions. This can separate records belonging to different users or organizations within shared tables.

The protection depends on correct policies and the roles used to access the database. Disabling policies or using a privileged bypass can undermine the intended boundary, so application behavior and actual database access need verification.

ELI5

Row-level security is like letting each person open only the folders they are entitled to, even when the folders share one cabinet.

For example, a customer should be able to read their own order but not another customer's order. The database checks the rule rather than relying only on the screen to hide other orders.

Is hiding records in the interface enough?

No. Interface filtering is not equivalent to database enforcement of which records a requester is allowed to access.

Does enabling row-level security guarantee correct access?

No. Policies and database roles still need to be configured and tested against the intended permissions.

  1. David Ondrej and Ant Wilson beside the blue and white headline Agent Ready Software on black.
Definition card for row-level security: What is row-level security?

Row-level security applies database policies that control which individual rows a user or application may read or modify.