Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebzvI-00073d-Eg for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jan 2018 02:27:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebzvG-00051u-Nv for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jan 2018 02:27:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ebzvG-00051l-Fv for pgsql-bugs@lists.postgresql.org; Thu, 18 Jan 2018 02:27:22 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ebzv8-0007OR-PC for pgsql-bugs@lists.postgresql.org; Thu, 18 Jan 2018 02:27:21 +0000 Received: by mail-pg0-x242.google.com with SMTP id z17so12723067pgc.4 for ; Wed, 17 Jan 2018 18:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SWWRgUpwf6W3Mxd7/0hr281t1maHnYt2ujA+wE8fThw=; b=qEoJRoWu+NpXSRn3bw1RkJ2vFzIkZ/wnyvwv+7DrQWCx/MLSwY0du4Q9r99gzNyc9t xku5JdqITf+tOoYDw/WDuiuMdDqhIGiXbnG74RKmdiJIvxAPgG3DgTs7bluRCbDSKtGO 3UpDCpz0Ie+HXlXiNPpgZnW8w8W3yivCKA1fzQ9ixTmlbJtv1xu8BXkGpjDVXE/yDekt fBfPLgicSvRV5aLENkA0Is8TRFCajjEK/n1dtu9W9Pk2jq84GgGqn+1VzPskDhbbKlkA S5f7zfdE7Vf7FnEr/SdF2bzcEKEc0jqWbFQemD2+i7G536JIdQEPDLJZwTeWyKv+uv8C TyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SWWRgUpwf6W3Mxd7/0hr281t1maHnYt2ujA+wE8fThw=; b=l+zDN6HrJqw7NnmfrfUgsH2Op7uWmJidqmJzaNC5dICg+2qnVlCsDJbHjeXeceiP3m OW2wZjz9+aWAqhHPrAmJViL5PNzttQ64xZieXDUo8B5Dn1Z1E/++wjQIiDwdZ4cuRXVZ TuRi7QTJMQcKwh61O8BlJ3gHCUac0zDIPR+UDuTmJiKblvcMpN59UCyjcXy9ItEeZYGP kneKO6BvCzws3qUmF96a800ehLVV88VSINi0cpuoJR7uvs5UtPmARsbFP5QbV23mU69N VB5NypcIPuZJCGTbojoZvn299/Aeu+tWw3zJai9+VvWUY6ixNDzEqp0Wv3CaE1ZD7tjL h8KQ== X-Gm-Message-State: AKGB3mLjcKFT8pHQgCHH0vywerWOEqR1JAINf1+JLLWL+BqV8GaGUl8G mBkUSy0OwYZY6rjKlrHBDGk= X-Google-Smtp-Source: ACJfBovH4sMlXGaGXcetCsD+NbARxhuSs/iP9ElyaZ3VuUzAfzDa5CKT0qV65F57+p8/OrV4QjN6jg== X-Received: by 10.99.96.203 with SMTP id u194mr33176417pgb.167.1516242432111; Wed, 17 Jan 2018 18:27:12 -0800 (PST) Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp. [61.215.137.162]) by smtp.gmail.com with ESMTPSA id e190sm10133889pfe.15.2018.01.17.18.27.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 18:27:10 -0800 (PST) Date: Thu, 18 Jan 2018 11:27:06 +0900 From: Michael Paquier To: Tom Lane Cc: "David G. Johnston" , Tomas Vondra , eshkinkot@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15006: "make check" error if current user is "user" Message-ID: <20180118022706.GF29962@paquier.xyz> References: <20180111125319.1423.23692@wrigleys.postgresql.org> <3568.1516234863@sss.pgh.pa.us> <20180118013509.GC29962@paquier.xyz> <10654.1516241706@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QNDPHrPUIc00TOLW" Content-Disposition: inline In-Reply-To: <10654.1516241706@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --QNDPHrPUIc00TOLW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote: > Michael Paquier 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. >=20 > Good question. There may be some backwards-compatibility considerations > here, but still this is just plain inconsistent: > > >=20 > 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: =3D# CREATE ROLE "Public";=20 CREATE ROLE =3D# CREATE ROLE "pG_as"; CREATE ROLE So those are correctly handled now. Worth noting also this bit (from IsReservedName), which looks correct to me: =3D# 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.=20 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 --QNDPHrPUIc00TOLW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlpgBfoACgkQnvQgOdby QH0E2w//bDhcMAcCN9SQC7+k6A0o+PubV4TVg0LQQjQvBvFmLn6qsd4+23Zt4UtA wKX1aBXasFUyJGpdWFJQAlI7GcDhJQ6a0j3KT8MB7xwI1OgsvwQts3clcaYGZFRC dO1VXOssGw3kDyWtPQUQsHXZenbjGAQhQJMcUgKBRR8FeQf/0ZD2X2Q/te2qUcs3 eiGR9s0c83aJzLQT/1ZZgPWsOBgoYEGTwXrcnhkN6jVTvI7awB1GL5Z7AmAfYAsa ojOTHz0Gl9We79EuyBGdDsPhVRwEo4eTM44aR59ciG/o2fJn6CU/2bCP/BmEJkKj 5WZkccV2DEJk0GzQlQy2Ty9tkiynTEkhVIOhbd5AAausmXpRVwXmU9Hpq6VNyRNH g9IZYjfiee0PmOMFAKwA4PY5OcDZLVEWDFN/JnF6CvUqAr3VFFNMKFBL/u95r3jQ 6VKMecmGxo+wfj+vIRUlmfTUfsMa6efNd3Ojl1UWqWdwdMPdeq6Jl69PFIo4eZsR SMkb6O0//VrKbtgJ8dajBT3IqNG6xr+OYBC46l1Hemj28ynyOOscRlHiL3w8oecJ rybDSjyijKytuXzpjhsdPYZkX0m/rc+Olt/aaGuon263AN3J3hg8kz0jDOHyt6KH dJl+4rmHK4tUGximVkENYytiwBkepg+vRTIDk6qftzGsYKgb3qw= =jkDE -----END PGP SIGNATURE----- --QNDPHrPUIc00TOLW--