Comparison
AuthorizationvsRow-level security
Authorization
you check whether this particular user is allowed to touch this particular record, not merely that they are logged in.
Deciding whether an authenticated principal may perform an action on a resource. The dangerous gap is object-level: the endpoint checks the role but not that the record belongs to the caller, so changing an id in the URL returns someone else's data. It must be enforced server-side per request, on every path that reaches the resource.
Full entry →Row-level security
the regional manager runs the same query as everyone else and only ever sees their own region's rows.
A policy attached to a table that filters which rows a given principal may see. It lets one modelled table serve every audience instead of maintaining a copy per team, which is the alternative and the reason copies proliferate. The risk is subtle: an aggregate over filtered rows still looks like a complete answer, so a user can be confidently wrong without any indication that rows were removed.
Full entry →