pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust interaction of CREATEROLE with role properties.
Date: Tue, 24 Jan 2023 16:00:24 +0000
Message-ID: <E1pKLii-005G5B-Br@gemulon.postgresql.org> (raw)

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(-)



view thread (13+ messages)  latest in thread

Message-ID: <E1pKLii-005G5B-Br@gemulon.postgresql.org>
Permalink:  ../E1pKLii-005G5B-Br@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pKLii-005G5B-Br@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Adjust interaction of CREATEROLE with role properties.
  In-Reply-To: <E1pKLii-005G5B-Br@gemulon.postgresql.org>
  References: <E1pKLii-005G5B-Br@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox