From: Bruce Momjian <bruce@momjian.us>
To: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Cc: Noah Misch <noah@leadboat.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely
Date: Fri, 7 Oct 2022 09:35:49 -0400
Message-ID: <Y0ArNYxcHbimR6zN@momjian.us> (raw)
In-Reply-To: <AM9PR01MB8268FB1629B5AAF1680E0594FE5C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
References: <AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
<Yvvw1JB/Y12HvAYn@momjian.us>
<YzR/X5Hhyu4HaUj2@momjian.us>
<AM9PR01MB8268FB1629B5AAF1680E0594FE5C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
On Fri, Oct 7, 2022 at 08:05:36AM +0000, Erki Eessaar wrote:
> Hello
>
> I confirmed, that setting search_path is indeed sometimes needed in case of
> SECURITY DEFINER routines that have SQL-standard bodies. See an example at the
> end of the letter.
>
> I suggest the following paragraph to the documentation:
>
> Starting from PostgreSQL 14 SQL-standard bodies can be used in SQL-language
> functions. This form tracks dependencies between the function and objects used
> in the function body. However, there is still a possibility that such function
> calls other code that reacts to search path. Thus, as a best practice, SECURITY
> DEFINER functions with SQL-standard bodies should also override search_path.
I think this gets back to what Noah said about this section not needing
to explain all the details but rather give general guidance. I am not
sure adding the reasons for _why_ you should use search path for
SQL-standard bodies is really adding anything. Noah, is that accurate?
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
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-docs@postgresql.org
Cc: bruce@momjian.us, erki.eessaar@taltech.ee, pgsql-docs@lists.postgresql.org, noah@leadboat.com, peter.eisentraut@enterprisedb.com
Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely
In-Reply-To: <Y0ArNYxcHbimR6zN@momjian.us>
* 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