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_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/448525e8a44080b6048e24f6942284b7eeae1a5c Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 67 ++++++++++++++++++++++++++++--- src/test/regress/expected/rowsecurity.out | 58 ++++++++++++++++++++++++++ src/test/regress/sql/rowsecurity.sql | 33 +++++++++++++++ src/tools/pgindent/typedefs.list | 1 + 4 files changed, 153 insertions(+), 6 deletions(-)