From: Michael Paquier <michael.paquier@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: eshkinkot@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15006: "make check" error if current user is "user"
Date: Thu, 18 Jan 2018 11:27:06 +0900
Message-ID: <20180118022706.GF29962@paquier.xyz> (raw)
In-Reply-To: <10654.1516241706@sss.pgh.pa.us>
References: <20180111125319.1423.23692@wrigleys.postgresql.org>
<d67a0d73-fbc4-f0b3-a5fd-eb1fcb42b555@2ndquadrant.com>
<CAKFQuwZpiOqt0hQ5OZX93V8hTNDhzW2Xxca-B0sic23f1eR28A@mail.gmail.com>
<3568.1516234863@sss.pgh.pa.us>
<20180118013509.GC29962@paquier.xyz>
<10654.1516241706@sss.pgh.pa.us>
On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> Perhaps a stupid question. What's the point behind the logic to forbid a
>> double-quoted "public" but to authorize a double-quoted "user"? The
>> whole thing looks inconsistent to me.
>
> Good question. There may be some backwards-compatibility considerations
> here, but still this is just plain inconsistent:
>
> <snip>
>
> I can see the point of disallowing a user named "public", because
> otherwise syntax like GRANT some-privilege TO PUBLIC is just a trap
> for the unwary DBA, one that could have bad security consequences.
> But it's not clear to me why the same logic doesn't apply to "user",
> "current_user", or "session_user", all of which are equally conflatable
> with a built-in meaning in some security-relevant contexts.
Just forgot to mention that double-quoted user names with upper-case
characters are similarly allowed should still be allowed, like:
=# CREATE ROLE "Public";
CREATE ROLE
=# CREATE ROLE "pG_as";
CREATE ROLE
So those are correctly handled now.
Worth noting also this bit (from IsReservedName), which looks correct to
me:
=# CREATE ROLE "pg_aB";
ERROR: 42939: role name "pg_aB" is reserved
DETAIL: Role names starting with "pg_" are reserved.
> BTW, you might think that those wildly different phrasings of essentially
> the same error come from different places in the code, but no, they are
> from adjacent lines in gram.y. WTF? This seems to be deliberately
> anti-consistent.
Same reaction here :)
I would have expected all the checks to be in user.c and at parsing
level.
> Probably the OP would not be very happy if the outcome of this discussion
> is that "initdb -U user" fails, but I am not seeing a principled reason
> why that should be allowed.
Me neither.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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-bugs@postgresql.org
Cc: michael.paquier@gmail.com, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, tomas.vondra@2ndquadrant.com, eshkinkot@gmail.com
Subject: Re: BUG #15006: "make check" error if current user is "user"
In-Reply-To: <20180118022706.GF29962@paquier.xyz>
References: <20180111125319.1423.23692@wrigleys.postgresql.org> <d67a0d73-fbc4-f0b3-a5fd-eb1fcb42b555@2ndquadrant.com> <CAKFQuwZpiOqt0hQ5OZX93V8hTNDhzW2Xxca-B0sic23f1eR28A@mail.gmail.com> <3568.1516234863@sss.pgh.pa.us> <20180118013509.GC29962@paquier.xyz> <10654.1516241706@sss.pgh.pa.us> <20180118022706.GF29962@paquier.xyz>
* 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