Re: User-Id Tracking when Portal was started

Поиск
Список
Период
Сортировка
От Kohei KaiGai
Тема Re: User-Id Tracking when Portal was started
Дата
Msg-id CADyhKSXJ7-n53unMnjQQMt4sDjUVcmKb7MZMTnwvZain=mVrkg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: User-Id Tracking when Portal was started  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: User-Id Tracking when Portal was started  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
2012/7/3 Robert Haas <robertmhaas@gmail.com>:
> On Mon, Jul 2, 2012 at 10:55 AM, Kohei KaiGai <kaigai@kaigai.gr.jp> wrote:
>> The attached patch is delivered from the discussion around row-level
>> access control feature. A problem Florian pointed out is refcursor
>> declared in security definer function. Even though all the permission
>> checks are applied based on privilege of the owner of security-definer
>> function in case when it tries to define a cursor bound to a particular
>> query, it shall be executed under the credential of executor.
>> In the result, "current_user" or "has_table_privilege()" will return
>> unexpected result, even if it would be used in as a part of security
>> policy for each row.
>
> Why not just save and restore the user ID and security context
> unconditionally, instead of doing this kind of dance?
>
> +               if (portal->userId != GetUserId())
> +                       SetUserIdAndSecContext(portal->userId, portal->secCo
> +               else
> +                       saveUserId = InvalidOid;
>
In case when CurrentUserId was updated during the code block
(E.g, execution of SET SESSION AUTHORIZATION), it overwrites
this update on restoring user-id and security-context.

Comparison of user-id is a simple marker to check whether this
portal contain an operation to switch user-id, because these
operations are prohibited within security restricted context.
(Is there some other good criteria?)

Thanks,
-- 
KaiGai Kohei <kaigai@kaigai.gr.jp>


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Incorrect behaviour when using a GiST index on points
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [Review] Add SPI_gettypmod() to return a field's typemod from a TupleDesc