pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Add new GUC createrole_self_grant.
Date: Tue, 10 Jan 2023 22:25:04 -0500
Message-ID: <408089.1673407504@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoYzCt16YKRTZPQ-LYdWgkRAC7RuUxOkwBr_rhA3LoXg4g@mail.gmail.com>
References: <E1pFIhD-0030IS-UU@gemulon.postgresql.org>
	<399118.1673401630@sss.pgh.pa.us>
	<CA+TgmoZdOYxkPOWHD+3gG=DDccg9cDVYS8EtpO9EY85NNMaNtg@mail.gmail.com>
	<404209.1673404807@sss.pgh.pa.us>
	<CA+TgmoYzCt16YKRTZPQ-LYdWgkRAC7RuUxOkwBr_rhA3LoXg4g@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jan 10, 2023 at 9:40 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The scenario I'm worried about could be closed, mostly, if we were willing
>> to invent an intermediate GUC privilege level "can be set interactively
>> but only by CREATEROLE holders" ("PGC_CRSET"?).

> Of course, if it's possible for a non-CREATEROLE user to set the value
> that a CREATEROLE user experiences, that'd be more of a problem --

That's exactly the case I'm worried about, and it's completely reachable
if a CREATEROLE user makes a SECURITY DEFINER function that executes
an affected GRANT and is callable by an unprivileged user.  Now, that
probably isn't terribly likely, and it's unclear that there'd be any
serious security consequence even if the GRANT did do something
different than the author of the SECURITY DEFINER function was expecting.
Nonetheless, I'm feeling itchy about this chain of assumptions.

> To answer your question directly, though, I don't know of any other
> setting where that would be a useful level.

Yeah, I didn't think of one either.  Also, even if we invented PGC_CRSET,
it can't stop one CREATEROLE user from attacking another one, assuming
that there is some interesting attack that can be constructed here.
I think the whole point of your recent patches is to not assume that
CREATEROLE users are mutually trusting, so that's bad.

Bottom line is that a GUC doesn't feel like the right mechanism to use.
What do you think about inventing a role property, or a grantable role
that controls this behavior?

			regards, tom lane





view thread (20+ messages)  latest in thread

Message-ID: <408089.1673407504@sss.pgh.pa.us>
Permalink:  ../408089.1673407504@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/408089.1673407504@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Add new GUC createrole_self_grant.
  In-Reply-To: <408089.1673407504@sss.pgh.pa.us>
  References: <E1pFIhD-0030IS-UU@gemulon.postgresql.org> <399118.1673401630@sss.pgh.pa.us> <CA+TgmoZdOYxkPOWHD+3gG=DDccg9cDVYS8EtpO9EY85NNMaNtg@mail.gmail.com> <404209.1673404807@sss.pgh.pa.us> <CA+TgmoYzCt16YKRTZPQ-LYdWgkRAC7RuUxOkwBr_rhA3LoXg4g@mail.gmail.com> <408089.1673407504@sss.pgh.pa.us>

* 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