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 <[email protected]>
Author: Nathan Bossart <[email protected]>
Security: CVE-2026-116303
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3409adfbe3d555074a42bbcd91de9eeeac74cb81
Author: Nathan Bossart <[email protected]>

Modified Files
--------------
src/backend/utils/adt/ri_triggers.c       | 12 ++++++++++++
src/test/regress/expected/foreign_key.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/foreign_key.sql      | 27 +++++++++++++++++++++++++++
3 files changed, 65 insertions(+)

Reply via email to