pgsql: Check EXECUTE privilege on foreign key cast functions.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check EXECUTE privilege on foreign key cast functions.
Date: 2026-11-09 14:21:48
Message-ID: E1xQQFo-000000003HD-3nZa@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check EXECUTE privilege on foreign key cast functions.

When a foreign key's referencing column must be cast to the type of
the referenced column, the comparison that decides whether an
UPDATE of the referencing table changed the key executes the cast
function without first checking for EXECUTE privileges. To fix,
check privileges and invoke the function execution hook before
calling the cast function. Note that this check is made as the
user issuing the UPDATE, since the comparison happens before any
switch to the referenced table's owner.

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Author: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Security: CVE-2026-116303
Backpatch-through: 14

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/ri_triggers.c | 10 ++++++++++
src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++
src/test/regress/sql/foreign_key.sql | 22 ++++++++++++++++++++++
3 files changed, 53 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:21:49 pgsql: Reject more unsafe names in extension script substitutions.
Previous Message Noah Misch 2026-11-09 14:21:47 pgsql: pg_basebackup: Fix use of externally-controlled format string