From: Stephen Frost <sfrost@snowman.net>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: quae@daurnimator.com, pgsql-bugs@lists.postgresql.org, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: BUG #15708: RLS 'using' running as wrong user when called from a view
Date: Mon, 25 Mar 2019 16:27:23 -0400
Message-ID: <20190325202723.GC6197@tamriel.snowman.net> (raw)
In-Reply-To: <CAEZATCV-UjLxmzk7sZhiu9fMnOoaQwZ2frtUrsu0gwg_VZ8JMg@mail.gmail.com>
References: <15708-d65cab2ce9b1717a@postgresql.org>
<CAEZATCV-UjLxmzk7sZhiu9fMnOoaQwZ2frtUrsu0gwg_VZ8JMg@mail.gmail.com>
Greetings,
* Dean Rasheed (dean.a.rasheed@gmail.com) wrote:
> On Thu, 21 Mar 2019 at 00:39, PG Bug reporting form
> <noreply@postgresql.org> wrote:
> >
> > This fails, seemingly because the RLS on 'bar' is being checked by alice,
> > instead of the view owner bob:
>
> Yes I agree, that appears to be a bug. The subquery in the RLS policy
> should be checked as the view owner -- i.e., we need to propagate the
> checkAsUser for the RTE with RLS to any subqueries in its RLS
> policies.
Agreed.
> It looks like the best place to fix it is in
> get_policies_for_relation(), since that's where all the policies to be
> applied for a given RTE are pulled together. Patch attached.
Yes, on a quick review, that looks like a good solution to me as well.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: sfrost@snowman.net, dean.a.rasheed@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: BUG #15708: RLS 'using' running as wrong user when called from a view
In-Reply-To: <20190325202723.GC6197@tamriel.snowman.net>
References: <15708-d65cab2ce9b1717a@postgresql.org> <CAEZATCV-UjLxmzk7sZhiu9fMnOoaQwZ2frtUrsu0gwg_VZ8JMg@mail.gmail.com> <20190325202723.GC6197@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox