pgsql: Ensure cached plans are correctly marked as dependent on role.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Ensure cached plans are correctly marked as dependent on role.
Date: 2024-11-11 15:00:50
Message-ID: E1tAVuL-001Ji7-QJ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ensure cached plans are correctly marked as dependent on role.

If a CTE, subquery, sublink, security invoker view, or coercion
projection references a table with row-level security policies, we
neglected to mark the plan as potentially dependent on which role
is executing it. This could lead to later executions in the same
session returning or hiding rows that should have been hidden or
returned instead.

Reported-by: Wolfgang Walther
Reviewed-by: Noah Misch
Security: CVE-2024-10976
Backpatch-through: 12

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4e51030af9e0a12d7fa06b73acd0c85024f81062

Modified Files
--------------
src/backend/executor/functions.c | 6 +++
src/backend/rewrite/rewriteHandler.c | 67 +++++++++++++++++++++++---
src/test/regress/expected/rowsecurity.out | 78 +++++++++++++++++++++++++++++++
src/test/regress/sql/rowsecurity.sql | 44 +++++++++++++++++
src/tools/pgindent/typedefs.list | 1 +
5 files changed, 190 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-11-11 15:30:14 pgsql: Fix improper interactions between session_authorization and role
Previous Message Noah Misch 2024-11-11 14:26:09 pgsql: Block environment variable mutations from trusted PL/Perl.