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: Fix security checks for selectivity estimation functions with RL
Date: Mon, 06 May 2019 10:50:39 +0000
Message-ID: <E1hNbCh-0004Ph-8i@gemulon.postgresql.org> (raw)

Fix security checks for selectivity estimation functions with RLS.

In commit e2d4ef8de8, security checks were added to prevent
user-supplied operators from running over data from pg_statistic
unless the user has table or column privileges on the table, or the
operator is leakproof. For a table with RLS, however, checking for
table or column privileges is insufficient, since that does not
guarantee that the user has permission to view all of the column's
data.

Fix this by also checking for securityQuals on the RTE, and insisting
that the operator be leakproof if there are any. Thus the
leakproofness check will only be skipped if there are no securityQuals
and the user has table or column privileges on the table -- i.e., only
if we know that the user has access to all the data in the column.

Back-patch to 9.5 where RLS was added.

Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.

Security: CVE-2019-10130

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9408028305ac86d9913eaea49442cd7fdfa8aaca

Modified Files
--------------
src/backend/utils/adt/selfuncs.c          | 21 +++++++++++++++------
src/test/regress/expected/rowsecurity.out | 21 +++++++++++++++++++++
src/test/regress/sql/rowsecurity.sql      | 20 ++++++++++++++++++++
3 files changed, 56 insertions(+), 6 deletions(-)



view thread (5+ messages)

Message-ID: <E1hNbCh-0004Ph-8i@gemulon.postgresql.org>
Permalink:  ../E1hNbCh-0004Ph-8i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hNbCh-0004Ph-8i@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: Fix security checks for selectivity estimation functions with RL
  In-Reply-To: <E1hNbCh-0004Ph-8i@gemulon.postgresql.org>
  References: <E1hNbCh-0004Ph-8i@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