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 1odaXE-00041y-Vy for pgsql-docs@arkaria.postgresql.org; Wed, 28 Sep 2022 17:07:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1odaXD-0005UL-UN for pgsql-docs@arkaria.postgresql.org; Wed, 28 Sep 2022 17:07:47 +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 1odaVW-0002vc-7A for pgsql-docs@lists.postgresql.org; Wed, 28 Sep 2022 17:06:02 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odaVT-0001AX-RY for pgsql-docs@lists.postgresql.org; Wed, 28 Sep 2022 17:06:01 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1odaVN-009k1S-BI; Wed, 28 Sep 2022 13:05:53 -0400 Date: Wed, 28 Sep 2022 13:05:53 -0400 From: Bruce Momjian To: Noah Misch Cc: Peter Eisentraut , Tom Lane , Erki Eessaar , "pgsql-docs@lists.postgresql.org" Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely Message-ID: References: <1408823.1660678462@sss.pgh.pa.us> <20220912044647.GA1404410@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220912044647.GA1404410@rfd.leadboat.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Sep 11, 2022 at 09:46:47PM -0700, Noah Misch wrote: > On Thu, Sep 08, 2022 at 01:20:31PM +0200, Peter Eisentraut wrote: > > On 01.09.22 03:11, Bruce Momjian wrote: > > >On Tue, Aug 16, 2022 at 03:38:13PM -0400, Bruce Momjian wrote: > > >>On Tue, Aug 16, 2022 at 03:34:22PM -0400, Tom Lane wrote: > > >>>Bruce Momjian writes: > > >>>>I have written the attached patch to mention this issue about sql_body > > >>>>functions. > > >>> > > >>>Spell-check, please. Seems OK otherwise. > > > >Patch applied back to PG 10. Thanks. > > > > This feature is new in PG 14, so backpatching further than that doesn't make > > sense. > > Even an sql_body function should override search_path, because it may call > other code that reacts to search_path. Separately, the new sentence is near > the start of a section that addresses more than just search_path. The section > ends with the "revoke the default PUBLIC privileges" topic, which is no less > relevant to sql_body functions. > > Documentation needn't explain cases that make a best practice optional, and it > should explain only valuable ones. Omitting search_path on sql_body SECURITY > DEFINER functions isn't that valuable. If it were valuable, the patch's > sentence gives too little detail for the reader to decide what's safe for a > given function. I think this section should not attempt such detail. It's > enough to give the best practice, as the documentation did before this change. Agreed, patch reverted in all branches. Thanks for the feedback. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson