Re: check_circularity does not prevent from creating circular grants

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: check_circularity does not prevent from creating circular grants
Date: 2026-08-10 09:42:57
Message-ID: B5FF55D4-68CE-4875-9999-DF482BB7C6EA@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 10 Aug 2026, at 12:03, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> I discovered a sequence of ddl which creates grant configuration,
> unrestorable from pg_dump-pg_restore.

The diagnosis looks right, but I think the proposed fix is too broad.

Suppose the owner grants an option directly to role A, role B is a member
of A, and A grants the option to B. This is not circular: after revoking
B's membership in A, the grant from A remains valid. Changing the loop to
has_privs_of_role(B, A) would remove A's independently held option and
reject this case.

select_best_grantor() uses aclmask_direct() instead of aclmask(). WDYT about
this route?

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2026-08-10 09:48:55 Re: Add wait events for server logging destination writes
Previous Message Ashutosh Bapat 2026-08-10 09:40:48 Re: Error handling in after-startup shmem requests