From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Perform RLS subquery checks as the right user when going via a v
Date: Tue, 02 Apr 2019 07:31:44 +0000
Message-ID: <E1hBDtY-0003xJ-BQ@gemulon.postgresql.org> (raw)
Perform RLS subquery checks as the right user when going via a view.
When accessing a table with RLS via a view, the RLS checks are
performed as the view owner. However, the code neglected to propagate
that to any subqueries in the RLS checks. Fix that by calling
setRuleCheckAsUser() for all RLS policy quals and withCheckOption
checks for RTEs with RLS.
Back-patch to 9.5 where RLS was added.
Per bug #15708 from daurnimator.
Discussion: https://postgr.es/m/15708-d65cab2ce9b1717a@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e2d28c0f404713f564dc2250646551c75172f17b
Modified Files
--------------
src/backend/rewrite/rowsecurity.c | 8 ++++++++
src/test/regress/expected/rowsecurity.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/rowsecurity.sql | 26 ++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
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-committers@postgresql.org
Cc: dean.a.rasheed@gmail.com
Subject: Re: pgsql: Perform RLS subquery checks as the right user when going via a v
In-Reply-To: <E1hBDtY-0003xJ-BQ@gemulon.postgresql.org>
References: <E1hBDtY-0003xJ-BQ@gemulon.postgresql.org>
* 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