pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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-0003xQ-Bt@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
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2e606d0ad7984c15f323eacfc333990b93683cc7

Modified Files
--------------
src/backend/rewrite/rowsecurity.c         |  8 ++++++++
src/test/regress/expected/rowsecurity.out | 31 +++++++++++++++++++++++++++++++
src/test/regress/sql/rowsecurity.sql      | 31 +++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+)



view thread (5+ messages)  latest in thread

Message-ID: <E1hBDtY-0003xQ-Bt@gemulon.postgresql.org>
Permalink:  ../E1hBDtY-0003xQ-Bt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hBDtY-0003xQ-Bt@gemulon.postgresql.org

 · 

reply

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-0003xQ-Bt@gemulon.postgresql.org>
  References: <E1hBDtY-0003xQ-Bt@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