From: Joe Conway <mail@joeconway.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use has_privs_for_roles for predefined role checks
Date: Mon, 28 Mar 2022 19:11:08 +0000
Message-ID: <E1nYulf-001nTy-TU@gemulon.postgresql.org> (raw)
Use has_privs_for_roles for predefined role checks
Generally if a role is granted membership to another role with NOINHERIT
they must use SET ROLE to access the privileges of that role, however
with predefined roles the membership and privilege is conflated. Fix that
by replacing is_member_of_role with has_privs_for_role for predefined
roles. Patch does not remove is_member_of_role from acl.h, but it does
add a warning not to use that function for privilege checking. Not
backpatched based on hackers list discussion.
Author: Joshua Brindle
Reviewed-by: Stephen Frost, Nathan Bossart, Joe Conway
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6198420ad8a72e37f4fe4964616b17e0fd33b808
Modified Files
--------------
contrib/adminpack/adminpack.c | 2 +-
contrib/file_fdw/expected/file_fdw.out | 2 +-
contrib/file_fdw/file_fdw.c | 8 ++++----
contrib/pg_stat_statements/pg_stat_statements.c | 4 ++--
contrib/pgrowlocks/pgrowlocks.c | 2 +-
doc/src/sgml/adminpack.sgml | 6 +++---
doc/src/sgml/catalogs.sgml | 12 ++++++------
doc/src/sgml/func.sgml | 12 ++++++------
doc/src/sgml/monitoring.sgml | 2 +-
doc/src/sgml/pgbuffercache.sgml | 2 +-
doc/src/sgml/pgfreespacemap.sgml | 2 +-
doc/src/sgml/pgrowlocks.sgml | 2 +-
doc/src/sgml/pgstatstatements.sgml | 2 +-
doc/src/sgml/pgvisibility.sgml | 4 ++--
src/backend/commands/copy.c | 12 ++++++------
src/backend/replication/walreceiver.c | 8 ++++----
src/backend/replication/walsender.c | 8 ++++----
src/backend/utils/adt/acl.c | 4 ++++
src/backend/utils/adt/dbsize.c | 8 ++++----
src/backend/utils/adt/genfile.c | 6 +++---
src/backend/utils/adt/pgstatfuncs.c | 2 +-
src/backend/utils/misc/guc.c | 20 ++++++++++----------
src/test/modules/unsafe_tests/expected/rolenames.out | 2 +-
23 files changed, 68 insertions(+), 64 deletions(-)
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: mail@joeconway.com
Subject: Re: pgsql: Use has_privs_for_roles for predefined role checks
In-Reply-To: <E1nYulf-001nTy-TU@gemulon.postgresql.org>
References: <E1nYulf-001nTy-TU@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