| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
| Cc: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, 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 10:45:38 |
| Message-ID: | CALdSSPi5JaToi_p0=kPUynSTqUdqq8X-axRsrKL1TX0yt1KLiA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, 10 Aug 2026 at 15:35, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Mon, 10 Aug 2026 at 15:13, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>>
>>
>>
>> > 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?
>
>
> There was some prior discussion around this area on [0].
>
> Not sure if it's the same block, but just adding reference.
>
> Regards,
> Ayush
>
> [0] https://www.postgresql.org/message-id/CAJTYsWUvyQchDAA6y2a9YdLcApG%3DccArpsbr77FeNZyx40bnmQ%40mail.gmail.com
v2 with aclmask_direct function used in check_circular + regress test for this.
Ayush, yep i am aware of the thread you are pointing to, I had looked
into it before posting, but it looks like this is a slightly different
case.
Anyway, I want to review [0] soon, It was on my to-do list. Thank you
[0] https://www.postgresql.org/message-id/CAJTYsWUvyQchDAA6y2a9YdLcApG%3DccArpsbr77FeNZyx40bnmQ%40mail.gmail.com
--
Best regards,
Kirill Reshke
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fix-circular-grant-bug.patch | application/octet-stream | 6.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jakub Wartak | 2026-08-10 10:54:15 | Re: pg_stat_io_histogram |
| Previous Message | Etsuro Fujita | 2026-08-10 10:45:25 | Re: use of SPI by postgresImportForeignStatistics |