Re: [RFC] Interface of Row Level Security

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] Interface of Row Level Security
Date: 2012-05-29 15:13:39
Message-ID: CA+Tgmobpt34n4xFCfAp2sKc0JVGCeUAw73=aJ+-9245c_qMJ4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 29, 2012 at 10:57 AM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:
> 2012/5/29 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> One idea might be to have a grantable permission that permits the RLS
>> policy to be bypassed.  So, if a user has only SELECT permission, they
>> can select from the table, but the RLS policy will apply.  If they
>> have both SELECT and RLSBYPASS (probably not what we really want to
>> call it) permission, then they can select from the table and the RLS
>> policy will be skipped.  This means that superusers automatically skip
>> all RLS policies (which seems right) and table owners skip them by
>> default (but could revoke their own privileges) and other people can
>> skip them if the table owner (or the superuser) grants them the
>> appropriate privilege on the table involved.
>>
> Isn't it unavailable to describe using RLS policy?
> In case when 'alice' and 'bob' should bypass RLS policy on a certain table,
> we will be able to describe it as follows:
>    (current_user in ('alice', 'bob') OR rls_policy_this_table(X, Y, Z))
>
> I have one concern the "current_user in (...)" is not wiped out at the planner
> stage, although its evaluation result is obvious prior to execution.

Yes, that's one problem with doing it that way. The fact that the
superuser is not guaranteed-excluded is another; that can of course be
fixed by adding a special-case hack for superusers, but IMHO this is
more elegant.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2012-05-29 15:14:49 Re: [RFC] Interface of Row Level Security
Previous Message Robert Haas 2012-05-29 15:12:05 Re: [RFC] Interface of Row Level Security