pgsql: Check table ownership when DROP OWNED BY changes policies.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check table ownership when DROP OWNED BY changes policies.
Date: 2026-11-09 14:22:03
Message-ID: E1xQQG3-000000003mn-18sL@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check table ownership when DROP OWNED BY changes policies.

DROP OWNED BY removes the given roles from any row-level security
policies that apply to them, but it does not check that the current
user owns the table. This allows a role to remove itself from
restrictive policies on tables it does not own. To fix, leave such
policies unchanged and issue a warning, as is already done for
privileges that the current user cannot revoke.

Reported-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reported-by: Anthropic OSS program
Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Co-authored-by: Anthropic OSS program
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Reviewed-by: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Security: CVE-2026-116311
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/21c732aadf80b20721314cb59a838f9634ab2195
Author: Nathan Bossart <nathan(at)postgresql(dot)org>

Modified Files
--------------
src/backend/catalog/pg_shdepend.c | 4 ++--
src/backend/commands/policy.c | 21 +++++++++++++++++++++
src/test/regress/expected/rowsecurity.out | 7 +++++++
src/test/regress/sql/rowsecurity.sql | 7 +++++++
4 files changed, 37 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:22:04 pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
Previous Message Noah Misch 2026-11-09 14:22:02 pgsql: plperl: don't save and re-use temp context in return_next().