Re: replacing role-level NOINHERIT with a grant-level option
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: tushar <tushar.ahuja@enterprisedb.com>, Joe Conway <mail@joeconway.com>, Tom Lane <tgl@sss.pgh.pa.us>, "Bossart, Nathan" <bossartn@amazon.com>, Stephen Frost <sfrost@snowman.net>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2022-08-29T19:38:57Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-a-bug-in-roles_is_member_of.patch (application/octet-stream) patch v1-0001
On Mon, Aug 29, 2022 at 10:17 AM Robert Haas <robertmhaas@gmail.com> wrote: > Good catch. Thanks for the review. Committed with that correction. Argh, I found a bug, and one that I should have caught during testing, too. I modelled the new function select_best_grantor() on is_admin_of_role(), but it differs in that it calls roles_is_member_of() with ROLERECURSE_PRIVS rather than ROLECURSE_MEMBERS. Sadly, roles_is_member_of() handles ROLERECURSE_PRIVS by completely ignoring non-inherited grants, which is wrong, because then calls to select_best_grantor() treat a member of a role with INHERIT FALSE, ADMIN TRUE is if they were not an admin at all, which is incorrect. Here is a patch to rearrange the logic slightly and also add a test case memorializing the intended behavior. Without this change, the regression test included in the patch fails like this: ERROR: no possible grantors ...which is never supposed to happen. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix a bug in roles_is_member_of.
- 0101f770a05b 16.0 landed
-
docs: Fix up some out-of-date references to INHERIT/NOINHERIT.
- 620ac285483f 16.0 landed
-
Allow grant-level control of role inheritance behavior.
- e3ce2de09d81 16.0 landed
-
Make role grant system more consistent with other privileges.
- ce6b672e4455 16.0 cited
-
Document basebackup_to_shell.required_role.
- 26a0c025e233 15.0 landed