Re: allowing for control over SET ROLE
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2022-09-30T20:34:32Z
Lists: pgsql-hackers
Attachments
- v2-0001-Add-a-SET-option-to-the-GRANT-command.patch (application/octet-stream) patch v2-0001
On Wed, Aug 31, 2022 at 8:56 AM Robert Haas <robertmhaas@gmail.com> wrote: > In order to apply this patch, we'd need to reach a conclusion about > the matters mentioned in > http://postgr.es/m/CA+TgmobhEYYnW9vrHvoLvD8ODsPBJuU9CbK6tms6Owd70hFMTw@mail.gmail.com > -- and thinking about this patch might shed some light on what we'd > want to do over there. That thread has not reached an entirely satisfying conclusion. However, the behavior that was deemed outright buggy over there has been fixed. The remaining question is what to do about commands that allow you to give objects to other users (like ALTER <whatever> .. OWNER TO) or commands that allow you to create objects owned by other users (like CREATE DATABASE ... OWNER). I have, in this version, adopted the proposal by Wolfgang Walther on the other thread to make this controlled by the new SET option. This essentially takes the view that the ability to create objects owned by another user is not precisely a privilege, and is thus not inherited just because the INHERIT option is set on the GRANT, but it is something you can do if you could SET ROLE to that role, so we make it dependent on the SET option. This logic is certainly debatable, but it does have the practical advantage of making INHERIT TRUE, SET FALSE a useful combination of settings for predefined roles. It's also 100% backward-compatible, whereas if we made the behavior dependent on the INHERIT option, users could potentially notice behavior changes after upgrading to v16. So I do like this behavior ... but it's definitely arguable whether it's the best thing. At any rate, here's an updated patch that implements it, and to which I've also added a test case. Review appreciated. Thanks, -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
More documentation update for GRANT ... WITH SET OPTION.
- 3cdf7502f85c 16.0 landed
-
Restrict the privileges of CREATEROLE users.
- cf5eb37c5ee0 16.0 cited
-
Add support for GRANT SET in psql tab completion
- 9d0cf574920f 16.0 landed
-
Add a SET option to the GRANT command.
- 3d14e171e9e2 16.0 landed
-
Allow grant-level control of role inheritance behavior.
- e3ce2de09d81 16.0 cited