Re: Granting SET and ALTER SYSTE privileges for GUCs

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joshua Brindle <joshua(dot)brindle(at)crunchydata(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Joe Conway <joe(at)crunchydata(dot)com>
Subject: Re: Granting SET and ALTER SYSTE privileges for GUCs
Date: 2022-03-15 20:59:08
Message-ID: ADC4EBF7-87B2-438F-8BA1-8EF57F0E61CF@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mar 6, 2022, at 3:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> writes:
>> The existing patch allows grants on unknown gucs, because it can't know what guc an upgrade script will introduce, and the grant statement may need to execute before the guc exists.
>
> Yeah, that's the problematic case. It might mostly work to assume that
> an unknown GUC has an empty default ACL. This could fail to retain the
> default PUBLIC SET permission if it later turns out the GUC is USERSET

On further reflection, I concluded this isn't needed. No current extension, whether in-core or third party, expects to be able to create a new GUC and then grant or revoke permissions on it. They can already specify the guc context (PGC_USERS, etc). Introducing a feature that depends on the dubious assumption that unrecognized GUCs will turn out to be USERSET doesn't seem warranted.

The patch attributes all grants of setting privileges to the bootstrap superuser. Only superusers can grant or revoke privileges on settings, and all settings are implicitly owned by the bootstrap superuser because there is no explicit owner associated with settings. Consequently, select_best_grantor(some_superuser, ..., BOOTSTRAP_SUPERUSERID, ...) always chooses the bootstrap superuser. I don't see a problem with this, but wouldn't mind a second opinion. Some people might find it surprising when viewing the pg_setting_acl.setacl field.

Attachment Content-Type Size
v10-0001-Allow-grant-and-revoke-of-privileges-on-settings.patch application/octet-stream 134.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2022-03-15 21:23:40 Re: Window Function "Run Conditions"
Previous Message Daniel Gustafsson 2022-03-15 20:52:43 Re: On login trigger: take three