Re: Row security violation error is misleading

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: Row security violation error is misleading
Date: 2015-04-09 06:47:02
Message-ID: CAMsr+YH7cgZq3mvwZPgBz+TFY_Gc=Pd4cm+sAem=8i4Q3u-vnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8 April 2015 at 19:52, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:

> 2). In prepend_row_security_policies(), I think it is better to have
> any table RLS policies applied before any hook policies, so that a
> hook cannot be used to bypass built-in RLS.
>

A hook really has to be able to ensure that built-in RLS cannot bypass the
hook's policies, too, i.e. the hook policy *must* return true for the row
to be visible.

This is necessary for mandatory access control hooks, which need to be able
to say "permit if and only if..."

I'll take a closer look at this.

> 3). The infinite recursion detection in fireRIRrules() didn't properly
> manage the activeRIRs list in the case of WCOs, so it would
> incorrectly report infinite recusion if the same relation with RLS
> appeared more than once in the rtable, for example "UPDATE t ... FROM
> t ...".
>

I'm impressed you found that one.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2015-04-09 06:52:40 Re: Row security violation error is misleading
Previous Message Jeff Davis 2015-04-09 06:18:20 Re: Failure to coerce unknown type to specific type