From: Stephen Frost <sfrost@snowman.net>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Remove superuser() checks from pgstattuple
Date: Sun, 4 Sep 2016 11:41:58 -0400
Message-ID: <20160904154158.GN4028@tamriel.snowman.net> (raw)
In-Reply-To: <6e01d90c-337f-fc02-2021-6520b4a099b9@2ndquadrant.com>
References: <20160823212243.GJ4028@tamriel.snowman.net>
<6e01d90c-337f-fc02-2021-6520b4a099b9@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
* Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote:
> On 8/23/16 5:22 PM, Stephen Frost wrote:
> > Now that we track initial privileges on extension objects and changes to
> > those permissions, we can drop the superuser() checks from the various
> > functions which are part of the pgstattuple extension.
> >
> > Since a pg_upgrade will preserve the version of the extension which
> > existed prior to the upgrade, we can't simply modify the existing
> > functions but instead need to create new functions which remove the
> > checks and update the SQL-level functions to use the new functions
>
> I think this is a good change to pursue, and we'll likely want to do
> more similar changes in contrib. But I'm worried that what is logically
> a 10-line change will end up a 20 KiB patch every time.
This is primairly due to how we handle new versions of an extension.
Any change to an extension is going to involve a new upgrade script and
the removal of the prior version install script and addition of the new
version install scripts.
> Have we explored other options for addressing the upgrade problems?
We did discuss the upgrade issue and Noah proposed the current approach,
which appears to be the best option.
> Maybe the function could check that non-default privileges have been
> granted?
Simply changing the function to behave differently depending on what
privileges have or havn't been granted doesn't seem like a very good
idea.
Consider an existing installation where the admin tried to grant access
to one of these functions:
GRANT EXECUTE ON pgstattuple_func() TO bob;
This would result in a GRANT to bob explicitly, and the GRANT to public
would still be there also.
Then an upgrade of PG, without upgrading the extension, would lead to
any user being able to execute the function. An upgrade of the
extension would revoke the GRANT to PUBLIC and, further, would
hopefuflly cause the admin to consider checking the documentation about
the upgrade (which needs to be added; I'll do that).
We also created a new version to add the PARALLEL SAFE markings to the
functions. In general, I believe it's better to use a new version when
we're making these kinds of changes.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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-hackers@postgresql.org
Cc: sfrost@snowman.net, peter.eisentraut@2ndquadrant.com
Subject: Re: Remove superuser() checks from pgstattuple
In-Reply-To: <20160904154158.GN4028@tamriel.snowman.net>
References: <20160823212243.GJ4028@tamriel.snowman.net> <6e01d90c-337f-fc02-2021-6520b4a099b9@2ndquadrant.com> <20160904154158.GN4028@tamriel.snowman.net>
* 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