Re: security invoker review need full select (all columns) to do DML?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: security invoker review need full select (all columns) to do DML?
Date: 2024-08-21 14:39:44
Message-ID: 1777285.1724251184@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> The user must have select permissions on all columns selected by the
> subquery/view, because we don't go through the outer query to check
> which columns are actually referred to. Now maybe we could, but I
> suspect that would be quite a lot of effort because you'd need to be
> sure that the column wasn't referred to anywhere in either the outer
> query or the subquery itself (e.g., in WHERE clauses, etc.).

I'd argue that we should check that permission regardless, and are
probably required to by the SQL spec. You don't normally get to
escape permission checks when bits of the query are optimized away.
(This is why permission checks are done on the range table not the
plan tree.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Costa Alexoglou 2024-08-21 15:07:09 Re: insufficient privilege with pg_read_all_stats granted
Previous Message Dean Rasheed 2024-08-21 12:26:49 Re: security invoker review need full select (all columns) to do DML?