From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Wrong security context for deferred triggers? |
Date: | 2025-04-15 15:58:50 |
Message-ID: | 20250415155850.9b.nmisch@google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 23, 2025 at 07:28:19PM +0100, Laurenz Albe wrote:
> On Thu, 2025-01-23 at 12:30 -0500, Tom Lane wrote:
> > Pushed with some cosmetic adjustments
>
> Thank you!
commit 01463e1 wrote:
> +NOTICE: I am regress_groot
Let's not incur trivially-avoidable trademark risks
(https://google.com/search?q=%22i+am+groot%22) in the source tree.
> --- a/doc/src/sgml/trigger.sgml
> +++ b/doc/src/sgml/trigger.sgml
> @@ -129,6 +129,10 @@
> In all cases, a trigger is executed as part of the same transaction as
> the statement that triggered it, so if either the statement or the
> trigger causes an error, the effects of both will be rolled back.
> + Also, the trigger will always run in the security context of the role
> + that executed the statement that caused the trigger to fire, unless
> + the trigger function is defined as <literal>SECURITY DEFINER</literal>,
> + in which case it will run as the function owner.
Phrase "the role that executed the statement" doesn't match what happens if
the role changes mid-statement. Example of a statement that does so:
select set_config('role', rolname, true), current_user from pg_authid;
The term "security context" doesn't otherwise appear in doc/. I would just
change "run in the security context of the role" to "run as the role". That's
simpler and less likely to create an impression that this stops attacks.
From | Date | Subject | |
---|---|---|---|
Next Message | Dimitrios Apostolou | 2025-04-15 16:02:40 | Re: Fundamental scheduling bug in parallel restore of partitioned tables |
Previous Message | Christoph Berg | 2025-04-15 15:34:19 | Re: [PoC] Federated Authn/z with OAUTHBEARER |