Questions tagged [row-level-security]

Row-level security is database security term which relates to the ability to define and enforce access control logic on rows of data such that a user can only retrieve the rows of data he or she is allowed to view.

Row-level security is database security term which relates to the ability to define and enforce access control logic on rows of data such that a user can only retrieve the rows of data he or she is allowed to view.

Several database vendors provide row-level security mechanisms. For instance:

  • Oracle provides Virtual Private Database (VPD), a free feature of the Oracle Enterprise Database.
  • MySQL provides fine-grained access control (FGAC). This is further detailed in this 2006 article.
  • IBM DB2 provides row/column-level access control (RCAC). This is further detailed in this IBM knowledge base.
  • SQL Server and Azure SQL Database provide Row-Level Security (RLS). This is further detailed in the MSDN product documentation.

In row-level security, a user can ask to view a set of data e.g. medical records. The database table (or view) contains a complete set of medical records but only returns those records the user is entitled to view. The authorization is typically driven through the configuration of VPD/RCAC/FGAC or through an access control policy e.g. doctors can view the medical records of patients they are assigned to.

Row-level security is becoming more prevalent with the rise of and , technologies that help standardize access control.

An extension of row-level security is the ability to apply cell-level security. This space has been coined as dynamic data masking by Gartner analyst Joseph Feiman (see this report and these videos on data masking).

There are several third party vendor solutions which provide row-level security / dynamic data masking:

  • GreenSQL
  • Informatica DDM
  • Axiomatics Data Access Filter MD

Additional information and vendors are listed on Wikipedia.

199 questions
28
votes
2 answers

Why isn't row level security enabled for Postgres views?

I need strict control of the reading and writing of my Postgres data. Updatable views have always provided very good, strict, control of the reading of my data and allows me to add valuable computed columns. With Postgres 9.5 row level security has…
Calebmer
  • 2,217
  • 5
  • 25
  • 33
12
votes
2 answers

how to implement row level security in spring data jpa using hibernate filter or other ways?

One of the very important problems in information softwares is the existence of users with different roles with different duties and access levels. For instance, think of an organization with the structure (hierarchy) like below: [Organization Role…
12
votes
1 answer

PostgreSQL 9.5 - Row level security / ROLE best practices

I'm tying to grasp the best way to use the new row level security feature in a multi-tenant database that supports a web application. Currently, the application has a few different ROLEs available, depending on the action it is attempting to…
losthorse
  • 1,450
  • 13
  • 31
11
votes
1 answer

Implementing Row Level Security in SQL Server 2008

Is there a built-in feature, or way to simulate RLS(Row Level Security) in SQL Server 2008 as found in Oracle?
TonyP
  • 5,180
  • 13
  • 52
  • 88
11
votes
5 answers

Row Level Security with Entity Framework

I've been trying to consider how Row Level Security could be implemented with the Entity Framework. The idea is to have a database agnostic means that would offer methods to restrict the rows coming from the ObjectContext. Some of my inital ideas…
Rick
  • 722
  • 8
  • 17
10
votes
1 answer

Combining row level security with column grants

Let's say I have a users table with three columns, public_data, private_data, and system_data, and I have three roles named postgres, authenticated_user, and visitor. postgres is superuser and can access all data (including system_data of…
10
votes
1 answer

Row level security in SQL Server 2012

Is there something new about row-level security in SQL Server 2012? In 2008 and below the only way was using Views, in 2012 they announced something like Row Level Security in Tabular Models, does this have any relation to RLS over tables? Are there…
Shaddix
  • 5,337
  • 6
  • 42
  • 77
9
votes
3 answers

How to implement row-level security in Java?

I am currently evaluating authentication / authorization frameworks. Apache Shiro seems to be very nice but I am missing row-level security features. E.g. there might be special rows in a database which should only visible and accessible by users…
MRalwasser
  • 14,580
  • 14
  • 95
  • 134
8
votes
1 answer

Row level security(RLS) performance is significantly slower in postgres.

Description : Here is the sample demonstration of the performance issue. We first created two tables , enabled row level security and created policy as well . Table definition: create table sample_schema.sample_table1(ID numeric(38) PRIMARY KEY NOT…
7
votes
2 answers

Row level security for groups or Making rows accebile to groups

I want the rows in a table accessible to only members of groups. I create users and add them to group by following method, CREATE USER abc LOGIN PASSWORD 'securedpassword1'; CREATE USER xyz LOGIN PASSWORD 'securedpassword2'; ALTER GROUP permanent…
khaldi
  • 443
  • 5
  • 13
7
votes
2 answers

PostgreSQL query not using INDEX when RLS (Row Level Security) is enabled

I am using PostgreSQL 10.1, going right to the point... Lets say I have a TABLE: CREATE TABLE public.document ( id uuid PRIMARY KEY, title text, content text NOT NULL ); Together with a GIN INDEX on it: CREATE INDEX document_idx ON…
enisdenjo
  • 548
  • 6
  • 15
7
votes
1 answer

Row Level Security in Postgres on Normalized Tables

The premise In documentation, Row Level Security seems great. Based on what I've read I can now stop creating views like this: SELECT data.* FROM data JOIN user_data ON data.id = user_data.data_id AND user_data.role = CURRENT_ROLE The great part…
cazzer
  • 1,524
  • 1
  • 16
  • 26
7
votes
3 answers

Row-level security in a client-database scenario

I am looking for a good pattern to implement row-level security controls (via e.g. a proxy, man-in-the-middle web service, or stored procedures) suitable for use in a client->database environment. I control both the client and the database. Some…
Drew
  • 7,637
  • 5
  • 38
  • 40
6
votes
1 answer

PostgreSQL row-level security involving a view or a select with join

(suggestions for a better or more-descriptive title are welcome). I wonder if the following is possible in PostgreSQL using RLS (or any other mechanism). I want a user to be able to update certain rows of a table if its username matches a column in…
5
votes
1 answer

Postgres Trigger side-effect is occurring out of order with row-level security select policy

Context I am using row-level security along with triggers to implement a pure SQL RBAC implementation. While doing so I encountered a weird behavior between INSERT triggers and SELECT row-level security policies. For simplicity the rest of this…
Carl Sverre
  • 1,008
  • 10
  • 16
1
2 3
13 14