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: Add new GUC createrole_self_grant.
Date: Tue, 10 Jan 2023 17:46:00 +0000
Message-ID: <E1pFIhD-0030IS-UU@gemulon.postgresql.org> (raw)

Add new GUC createrole_self_grant.

Can be set to the empty string, or to either or both of "set" or
"inherit". If set to a non-empty value, a non-superuser who creates
a role (necessarily by relying up the CREATEROLE privilege) will
grant that role back to themselves with the specified options.

This isn't a security feature, because the grant that this feature
triggers can also be performed explicitly. Instead, it's a user experience
feature. A superuser would necessarily inherit the privileges of any
created role and be able to access all such roles via SET ROLE;
with this patch, you can configure createrole_self_grant = 'set, inherit'
to provide a similar experience for a user who has CREATEROLE but not
SUPERUSER.

Discussion: https://postgr.es/m/CA+TgmobN59ct+Emmz6ig1Nua2Q-_o=r6DSD98KfU53kctq_kQw@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/config.sgml                      | 33 +++++++++
doc/src/sgml/ref/create_role.sgml             |  1 +
doc/src/sgml/ref/createuser.sgml              |  1 +
src/backend/commands/user.c                   | 97 ++++++++++++++++++++++++++-
src/backend/utils/misc/guc_tables.c           | 12 ++++
src/backend/utils/misc/postgresql.conf.sample |  1 +
src/include/commands/user.h                   | 10 ++-
src/test/regress/expected/create_role.out     | 33 +++++++++
src/test/regress/sql/create_role.sql          | 37 ++++++++++
9 files changed, 220 insertions(+), 5 deletions(-)



view thread (20+ messages)  latest in thread

Message-ID: <E1pFIhD-0030IS-UU@gemulon.postgresql.org>
Permalink:  ../E1pFIhD-0030IS-UU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pFIhD-0030IS-UU@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: Add new GUC createrole_self_grant.
  In-Reply-To: <E1pFIhD-0030IS-UU@gemulon.postgresql.org>
  References: <E1pFIhD-0030IS-UU@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