Re: Using views for row-level access control is leaky

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Using views for row-level access control is leaky
Дата
Msg-id 4AE193C5.3000204@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Using views for row-level access control is leaky  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Using views for row-level access control is leaky
Список pgsql-hackers
Simon Riggs wrote:
> Also, we should presume that any function created with SECURITY DEFINER
> and created by a superuser would have plan security, so we don't need to
> annotate lots of old code to work securely. Annotating the built-in
> functions is a lot easier.

SECURITY DEFINER is an orthogonal aspect. Consider something as
innocent-looking as this:

CREATE FUNCTION secdeffunc(text) RETURNS boolean AS $$ SELECT
$1::integer < 10; $$ LANGUAGE SQL SECURITY DEFINER;

The text-to-integer cast throws an error and reveals the argument as
someone pointed out earlier in this thread. Creating such a function
shouldn't open the door to information leaks in views elsewhere.

The most useful "automatic" annotation I can see is to treat functions
implementing B-tree operators as safe. I *think* that's safe, anyway.

>> 2. If the view refers only one table (as a typical Veil view does), plan
>> it like we do today but enforce that view conditions are evaluated first
>> in the Filter. Notably, allow using any user-supplied conditions as
>> index quals if there's a matching index.
>>
>> 3. Otherwise fully materialize the view.
> 
> So if we join a normal table or a view to a secure view then only the
> secure view part would be materialized? Or do you mean the whole query
> would be materialized?

Just the secure view. Materializing the result of the overall query
wouldn't help.

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: SE-PgSQL developer documentation (Re: Reworks for Access Control facilities (r2363))
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Using views for row-level access control is leaky