Re:   Re: Re: Revoke Connect Privilege from Database not working

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Ing(dot) Marijo Kristo" <marijo(dot)kristo(at)icloud(dot)com>, PostgreSQL Bug List <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re:   Re: Re: Revoke Connect Privilege from Database not working
Date: 2025-11-13 16:47:14
Message-ID: aRYLkTpazxKhnS_w@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

On Mon, Apr 07, 2025 at 09:22:45AM -0700, David G. Johnston wrote:
> On Mon, Apr 7, 2025 at 9:06 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I believe what's going on there is explained by the rule that
>> "grants and revokes done by a superuser are done as if issued
>> by the object owner". So here, what would be revoked is
>> test_user=c/postgres, which isn't the privilege at issue.
>> Include GRANTED BY in the REVOKE to override the default
>> choice of grantor.
>
> The command in question did include "granted by" which is why this is a
> bug. The explicit granted by specification is being ignored if the
> invoking user is a superuser.

This is admittedly a half-formed idea, but perhaps we could have whatever's
specified in GRANTED BY override select_best_grantor(), like in the
attached patch. I've no idea if this is the intention of the standard, but
it should at least address the reported issue. FWIW I recently received an
independent report about the same thing.

--
nathan

Attachment Content-Type Size
v1-0001-GRANTED-BY.patch text/plain 7.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Dean Rasheed 2025-11-13 15:32:04 Re: BUG #19111: Using EXPLAIN ANALYZE with MERGE causes failed assert

Browse pgsql-sql by date

  From Date Subject
Previous Message Krzysztof 2025-11-02 21:45:51 Re: Linux file permission for COPY TO SQL command