Re: Wrong security context for deferred triggers? - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Wrong security context for deferred triggers?
Date
Msg-id 3f0a08f3e3d445137ae287125bc8c1a007045db8.camel@cybertec.at
Whole thread Raw
In response to Re: Wrong security context for deferred triggers?  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Wrong security context for deferred triggers?
List pgsql-hackers
On Fri, 2024-10-18 at 07:47 +0200, Pavel Stehule wrote:
> Without deeper checks I don't like using GetUserNameFromId for checking the validity of a role.
>
> Maybe it is better to use own read of syscache or wrap SetUserIdAndSecContext to do this check.

I agree; it was just the simplest way I could make it happen.  It is ugly to allocate and
return the user name, since we don't really need it.

I could write a dedicated function to check the existence of a user.

> The comment
>
> +       /*
> +        * The role could have been dropped since the trigger was queued.
> +        * In that case, give up and error out.
> +        */
>
> doesn't explain well why the role can be dropped and why dependency doesn't protect against it.

The trigger queue exists only in memory, and PostgreSQL tracks dependencies
only between persisted objects.  Do you think that I should add a sentence
like that to the comment?

Yours,
Laurenz Albe



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Add isolation test template in injection_points for wait/wakeup/detach
Next
From: Fujii Masao
Date:
Subject: Re: Remove unlogged materialized view persistence handling