Re: Review of Row Level Security - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Review of Row Level Security
Date
Msg-id CA+TgmoZt-tLAgOF1dynoudYdc=o4RqAyx-CzaE0OwgVFPSG1_Q@mail.gmail.com
Whole thread Raw
In response to Re: Review of Row Level Security  (Kohei KaiGai <kaigai@kaigai.gr.jp>)
Responses Re: Review of Row Level Security  (Simon Riggs <simon@2ndQuadrant.com>)
Re: Review of Row Level Security  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Review of Row Level Security  (Yeb Havinga <yebhavinga@gmail.com>)
List pgsql-hackers
On Tue, Dec 18, 2012 at 3:39 PM, Kohei KaiGai <kaigai@kaigai.gr.jp> wrote:
> postgres=> INSERT INTO t1 VALUES (4,'ddd');
> INSERT 0 1
> postgres=> INSERT INTO t1 VALUES (5,'eee');
> ERROR:  new row for relation "t1" violates row-secirity
> DETAIL:  Failing row contains (5, eee).

I've argued against this before - and maybe I should drop my
objection, because a number of people seem to be on the other side.
But I still think there will be some people who don't want this
behavior.  Right now, for example, you can give someone INSERT but not
SELECT permission on a table, and they will then be able to put rows
into the table that they cannot read back.  Similarly, in the RLS
case, it is not necessarily undesirable for a user to be able to
insert a row that they can't read back; or for them to be able to
update a row from a value that they can see to one that they cannot.
Some people will want to prohibit that, while others will not.

Previously, I suggested that we handle this by enforcing row-level
security only on data read from the table - the OLD row, so to speak -
and not on data written to the table - the NEW row, so to speak -
because the latter case can be handled well enough by triggers.  (The
OLD case cannot, because not seeing the row is different from erroring
out when you do see it.)  There are other alternatives, like allowing
the user to specify which behavior they want.  But I think that simply
decreeing that the policy will apply not only to rows read but also
rows written in all cases will be less flexible than we will
ultimately want to be.

YMMV, of course.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [ADMIN] Problems with enums after pg_upgrade
Next
From: Pavan Deolasee
Date:
Subject: Re: Set visibility map bit after HOT prune