pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Walther <walther@technowledgy.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: User with BYPASSRLS privilege can't change password
Date: Tue, 3 Nov 2020 19:05:32 +0100
Message-ID: <3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de> (raw)
In-Reply-To: <956994.1604425451@sss.pgh.pa.us>
References: <a5548a9f-89ee-3167-129d-162b5985fcf8@technowledgy.de>
	<923005.1604420579@sss.pgh.pa.us>
	<956994.1604425451@sss.pgh.pa.us>

Tom Lane:
> It's a little more subtle than that, but not much.  Commit 491c029db
> copied-and-pasted the logic used to deny non-superusers the privilege
> to change anything about a superuser role.  That was certainly not the
> intention, because the error message was phrased differently from the
> superuser case, but that was the effect.  I propose the attached.

Wouldn't the following change allow a non-superuser with createrole 
privilege to grant the replication privilege to a role that does not 
have that privilege, yet? This should still be forbidden, I think.

@@ -739,7 +741,6 @@ AlterRole(AlterRoleStmt *stmt)
  			  createrole < 0 &&
  			  createdb < 0 &&
  			  canlogin < 0 &&
-			  isreplication < 0 &&
  			  !dconnlimit &&
  			  !rolemembers &&
  			  !validUntil &&

This is because the "must be superuser to alter replication users" 
condition only triggers when the altered role already has isrepliaction, 
so isreplication could very well be >= 0 here.

The other change looks good.

Best

Wolfgang





view thread (14+ messages)  latest in thread

Message-ID: <3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de>
Permalink:  ../3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de/
Also on:    postgresql.org/message-id/3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: walther@technowledgy.de, tgl@sss.pgh.pa.us, sfrost@snowman.net, pgsql-bugs@lists.postgresql.org
  Subject: Re: User with BYPASSRLS privilege can't change password
  In-Reply-To: <3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de>

* 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