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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "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-04-07 16:22:45
Message-ID: CAKFQuwbpC5w6sUq8gZQATrviZUT4bYpxW+=2uH6sWWMg7fWjzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

On Mon, Apr 7, 2025 at 9:06 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On master, confirmed that after this command the privilege:
> > test_user=c/test_admin (on database testdb) still exists. That seems
> like
> > a bug. Its at least a POLA violation and I cannot figure out how to read
> > the revoke reference page in a way that explains it.
>
> 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.

revoke connect on database testdb:v
from test_user:v
---------------
granted by test_admin:v;
---^^^^^^^^^

So if we stick with status quo behavior we'd need to write the following
because the ignoring part is a POLA violation:

If a superuser chooses to issue a GRANT or REVOKE command, the command is
performed as though it were issued by the owner of the affected object, and
the granted by clause is ignored.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Laurenz Albe 2025-04-08 05:50:56 Re: PostgreSQL v15.12 fails to perform PG_UPGRADE from v13 and v9 on Windows
Previous Message Tom Lane 2025-04-07 16:06:17 Re:   Re: Re: Revoke Connect Privilege from Database not working

Browse pgsql-sql by date

  From Date Subject
Next Message Shay Patel 2025-04-14 19:25:38 Detached partitioning tables with RF keys in latest minor version is changed
Previous Message Tom Lane 2025-04-07 16:06:17 Re:   Re: Re: Revoke Connect Privilege from Database not working