Re: Failed assertion due to procedure created with SECURITY DEFINERoption
| От | Andres Freund |
|---|---|
| Тема | Re: Failed assertion due to procedure created with SECURITY DEFINERoption |
| Дата | |
| Msg-id | 20180629171917.nve4ane5bygbquze@alap3.anarazel.de обсуждение исходный текст |
| Ответ на | Re: Failed assertion due to procedure created with SECURITY DEFINERoption (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>) |
| Ответы |
Re: Failed assertion due to procedure created with SECURITY DEFINERoption
|
| Список | pgsql-hackers |
Hi,
On 2018-06-29 13:56:12 +0200, Peter Eisentraut wrote:
> On 6/29/18 13:07, amul sul wrote:
> > This happens because of in fmgr_security_definer() function we are
> > changing global variable SecurityRestrictionContext and in the
> > StartTransaction() insisting it should be zero, which is the problem.
>
> Hmm, what is the reason for this insistation?
Because it's supposed to be reset by AbortTransaction(), after an error.
/*
* Reset user ID which might have been changed transiently. We need this
* to clean up in case control escaped out of a SECURITY DEFINER function
* or other local change of CurrentUserId; therefore, the prior value of
* SecurityRestrictionContext also needs to be restored.
*
* (Note: it is not necessary to restore session authorization or role
* settings here because those can only be changed via GUC, and GUC will
* take care of rolling them back if need be.)
*/
SetUserIdAndSecContext(s->prevUser, s->prevSecContext);
I think all the state managed by transactions should be reviewed for
interactions with procedures. Can't imagine this being the only issue.
Greetings,
Andres Freund
В списке pgsql-hackers по дате отправления: