pgsql: Adjust interaction of CREATEROLE with role properties. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Adjust interaction of CREATEROLE with role properties.
Date
Msg-id E1pKLii-005G5B-Br@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Adjust interaction of CREATEROLE with role properties.  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-committers
Adjust interaction of CREATEROLE with role properties.

Previously, a CREATEROLE user without SUPERUSER could not alter
REPLICATION users in any way, and could not set the BYPASSRLS
attribute. However, they could manipulate the CREATEDB property
even if they themselves did not possess it.

With this change, a CREATEROLE user without SUPERUSER can set or
clear the REPLICATION, BYPASSRLS, or CREATEDB property on a new
role or a role that they have rights to manage if and only if
that property is set for their own role.

This implements the standard idea that you can't give permissions
you don't have (but you can give the ones you do have). We might
in the future want to provide more powerful ways to constrain
what a CREATEROLE user can do - for example, to limit whether
CONNECTION LIMIT can be set or the values to which it can be set -
but that is left as future work.

Patch by me, reviewed by Nathan Bossart, Tushar Ahuja, and Neha
Sharma.

Discussion: http://postgr.es/m/CA+TgmobX=LHg_J5aT=0pi9gJy=JdtrUVGAu0zhr-i5v5nNbJDg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f1358ca52dd7b8cedd29c6f2f8c163914f03ea2e

Modified Files
--------------
doc/src/sgml/ref/alter_role.sgml          | 13 +++--
doc/src/sgml/ref/create_role.sgml         | 23 +++------
src/backend/commands/dbcommands.c         |  3 +-
src/backend/commands/user.c               | 82 ++++++++++++++-----------------
src/include/commands/dbcommands.h         |  1 +
src/test/regress/expected/create_role.out | 53 ++++++++++++++++----
src/test/regress/sql/create_role.sql      | 45 ++++++++++++++---
7 files changed, 137 insertions(+), 83 deletions(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Fix the Drop Database hang.
Next
From: Andres Freund
Date:
Subject: Re: pgsql: instr_time: Represent time as an int64 on all platforms