Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jpu9w-0003Tv-Vf for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2020 13:49:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jpu9v-0005Ie-N6 for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2020 13:49:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jpu9v-0005IV-En for pgsql-general@lists.postgresql.org; Mon, 29 Jun 2020 13:49:19 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jpu9o-00050X-Mx for pgsql-general@lists.postgresql.org; Mon, 29 Jun 2020 13:49:18 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 8CB655F7A5; Mon, 29 Jun 2020 09:49:11 -0400 (EDT) Date: Mon, 29 Jun 2020 09:49:11 -0400 From: Stephen Frost To: Tom Lane Cc: Brad Nicholson , pgsql-general@lists.postgresql.org Subject: Re: PG13 Trusted Extension usability issue Message-ID: <20200629134911.GW3125@tamriel.snowman.net> References: <24570.1593197245@sss.pgh.pa.us> <30665.1593205561@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="j+D14l8Ki1YJdzYp" Content-Disposition: inline In-Reply-To: <30665.1593205561@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --j+D14l8Ki1YJdzYp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Tom Lane (tgl@sss.pgh.pa.us) wrote: > "Brad Nicholson" writes: > > Tom Lane wrote on 2020/06/26 02:47:25 PM: > >> I'm confused about your point here. postgresql_fdw has intentionally > >> *not* been marked trusted. That's partly because it doesn't seem like > >> outside-the-database access is something we want to allow by default, > >> but it's also the case that there are inside-the-database permissions > >> issues. >=20 > > Ah - I misread the docs. Specifically I read this: > > "For many extensions this means superuser privileges are needed. Howeve= r, > > if the extension is marked trusted in its control file, then it can be > > installed by any user who has CREATE privilege on the current database" > > To mean that you could mark any extension as trusted in the control fil= e to > > allow non-superuser installation. >=20 > Well, it's just like anything else in an open-source database: you can > change the code however you want, but the fallout from that is on you. >=20 > In the case at hand, you might be able to do what you want by adding > something along the line of >=20 > GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw > TO @extowner@ WITH GRANT OPTION; >=20 > to the extension install script. But nobody's researched whether that's > reasonable from a security standpoint, or whether it will play nicely > with dump/reload, etc etc. Indeed that could be done, and almost certainly will be by cloud vendors, resulting in more forks of PG done in different ways. I do agree that, in general, we need a way to allow a superuser to GRANT the right to connect to other systems (so that it could be done initially when creating the not-really-superuser-privileged-user, before the extension is created), since we don't want that to be allowed from the start, then have that checked by extensions, but once that's done it seems like it'd be alright to include the above GRANT USAGE in upstream (regarding this specific concern, at least). Seems like a default role would probably be the way to add that. Thanks, Stephen --j+D14l8Ki1YJdzYp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJe+fFXAAoJEO1sijiDR2RV6AwQAKeh4UyWpT6rGqtqcCqn0kDz YdgtUzASuE9AaWMRK+ATkrxBXiamfABltvJEQG4cHCUkV8+7WKZf4Ni2kRdb/BIR +ZW/KF4bkbyIS4wRvwyMxJy3nC31Xlp67Ocq9VnoBJFN76uqyIf2W4sugk354WZ7 I+QBv0zEFoMxgDBu/6QmUmxp8UZL621Np46ftdhrt2jQWxXrw0Jo5AMNOGQ4F/ZE 7Tt2V7D3q4rGVGaSrKZP00nQ34BFv5BKsTKSloh37AJ0Un9S/vVqLGI/9Ly7ebJ7 MdZGQDpknIavU2QelUAblCGamLTZIf3S2sMQ5Oc35Hzh2TEXtKOLDI6Pk2tiYCn6 dj2sq70V4nXXssFMovdvf7p5mTYWxpNY4XAo3uLT9UsD/F97VCwcEX356NXoZel9 9WMeDjq8tuH8b29ocPKzH2IOheT2OJ5Poj09MYSQ0WLalHbGzPpVBa88m0uoKuXj g1PImkPy4T6drFv3OzkvR2J8Mh62SJxmeQIvhLmgEKTFDxutW0VIVE2xpInuSJ6b APrwMw/NZzHW4Af7n0IbffBTIxL99EfHhz3nr6t+u99wRvf68vjVYpyizPb4TPC7 8oAvGNoTulhDpnZMkPY5K6aifcaCQm0Awhse1tfZ6ZCZOpFS4Mn5iNbMj+6BW13C tkzPUr7GcQpV5YugQY8b =Yr6A -----END PGP SIGNATURE----- --j+D14l8Ki1YJdzYp--