Re: WINDOW RANGE patch versus leakproofness - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: WINDOW RANGE patch versus leakproofness
Date
Msg-id CAEZATCX05LdV3p7hRTJ2AcSG9t+SgCiF-pTkFHtS9zO9oRJsjQ@mail.gmail.com
Whole thread Raw
In response to Re: WINDOW RANGE patch versus leakproofness  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 31 January 2018 at 21:51, Robert Haas <robertmhaas@gmail.com> wrote:
> On Wed, Jan 31, 2018 at 5:52 AM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> On 30 January 2018 at 16:42, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> So I'm thinking that (a) we do not need to check for leaky functions used
>>> in window support, and (b) therefore there's no need to avoid leaky
>>> behavior in in_range support functions.  Objections?
>>
>> Yes, I concur. Since window functions can only appear in the SELECT
>> target list and ORDER BY clauses, they should never appear in a qual
>> that gets considered for push down, and thus contain_leaked_vars()
>> should never see a window function.
>
> What about a query that uses window functions within a subquery?
>

A qual containing a subquery is treated as not push down safe, so it
wouldn't even be considered for pushing down into a security barrier
view. On a table with RLS, contain_leaked_vars() would see a subplan
on the restrictinfo's clause and return true, causing the restrictinfo
to be treated as leaky. So in each case, the qual with the subquery
would be executed after any security quals, regardless of what it
contained.

The contents of the subquery aren't currently examined, it just
defaults to leaky. If they were to be examined, the window function
would be found and it would still default to being leaky.

Regards,
Dean


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pgsql: doc: clearify trigger behavior for inheritance
Next
From: David Rowley
Date:
Subject: Re: [HACKERS] path toward faster partition pruning