pgsql: Include policies based on ACLs needed

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема pgsql: Include policies based on ACLs needed
Дата
Msg-id E1ZhFjX-00082F-1i@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Include policies based on ACLs needed

When considering which policies should be included, rather than look at
individual bits of the query (eg: if a RETURNING clause exists, or if a
WHERE clause exists which is referencing the table, or if it's a
FOR SHARE/UPDATE query), consider any case where we've determined
the user needs SELECT rights on the relation while doing an UPDATE or
DELETE to be a case where we apply SELECT policies, and any case where
we've deteremind that the user needs UPDATE rights on the relation while
doing a SELECT to be a case where we apply UPDATE policies.

This simplifies the logic and addresses concerns that a user could use
UPDATE or DELETE with a WHERE clauses to determine if rows exist, or
they could use SELECT .. FOR UPDATE to lock rows which they are not
actually allowed to modify through UPDATE policies.

Use list_append_unique() to avoid adding the same quals multiple times,
as, on balance, the cost of checking when adding the quals will almost
always be cheaper than keeping them and doing busywork for each tuple
during execution.

Back-patch to 9.5 where RLS was added.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7d8db3e8f37aec9d252353904e77381a18a2fa9f

Modified Files
--------------
src/backend/rewrite/rowsecurity.c         |  108 ++++++++++++++++++++---------
src/test/regress/expected/rowsecurity.out |   60 ++++++++--------
2 files changed, 101 insertions(+), 67 deletions(-)


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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: pgsql: Include policies based on ACLs needed
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Don't dump core when destroying an unused ParallelContext.