Re: Preventing non-superusers from altering session authorization

Поиск
Список
Период
Сортировка
От Joseph Koshakow
Тема Re: Preventing non-superusers from altering session authorization
Дата
Msg-id CAAvxfHeUKFE-=biJO15mMD5SNFSqDJy1zX2G-4=tDQkwfaBosg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Preventing non-superusers from altering session authorization  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: Preventing non-superusers from altering session authorization
Список pgsql-hackers


On Sat, Jul 8, 2023 at 6:09 PM Nathan Bossart <nathandbossart@gmail.com> wrote:

>> I think the issue here is that if a session loses the ability to set
>> their session authorization in the middle of a transaction, then
>> rolling back the transaction may fail and cause the server to panic.
>> That's probably what the deleted comment mean when it said:
>>
>>> * It's OK because the check does not require catalog access and can't
>>> * fail during an end-of-transaction GUC reversion
>
> Yeah.  IIUC the ERROR longjmps to a block that calls AbortTransaction(),
> which ERRORs again when resetting the session authorization, which causes
> us to call AbortTransaction() again, etc., etc.

Everything seems to work fine if the privilege check is moved to
check_session_authorization. Which is maybe what the comment meant
instead of assign_session_authorization.

I've attached a patch with this change.

Thanks,
Joe Koshakow
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: Preventing non-superusers from altering session authorization
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: check_strxfrm_bug()