pgsql: Restrict access to reindex of shared catalogs for non-privileged

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Restrict access to reindex of shared catalogs for non-privileged
Date: 2018-08-09 07:42:46
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Restrict access to reindex of shared catalogs for non-privileged users

A database owner running a database-level REINDEX has the possibility to
also do the operation on shared system catalogs without being an owner
of them, which allows him to block resources it should not have access
to. The same goes for a schema owner. For example, PostgreSQL would go
unresponsive and even block authentication if a lock is waited for
pg_authid. This commit makes sure that a user running a REINDEX SYSTEM,
DATABASE or SCHEMA only works on the following relations:
- The user is a superuser
- The user is the table owner
- The user is the database/schema owner, only if the relation worked on
is not shared.

Robert has worded most the documentation changes, and I have coded the
core part.

Reported-by: Lloyd Albin, Jeremy Schneider
Author: Michael Paquier, Robert Haas
Reviewed by: Nathan Bossart, Kyotaro Horiguchi
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 11- as the current behavior has been around for a
very long time and could be disruptive for already released branches.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/661dd23950f2e64646404605e99315d2379de0e5

Modified Files
--------------
doc/src/sgml/ref/reindex.sgml | 13 +++++++++----
src/backend/commands/indexcmds.c | 12 ++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-08-09 07:44:00 pgsql: Spell "partitionwise" consistently.
Previous Message Tom Lane 2018-08-09 00:02:55 pgsql: Remove bogus Assert in make_partitionedrel_pruneinfo().