agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check for USAGE privilege on types used by stored expressions.
Date: Mon, 10 Aug 2026 13:41:23 +0000
Message-ID: <E1wtQFn-00000000y5S-0JEd@gemulon.postgresql.org> (raw)

Check for USAGE privilege on types used by stored expressions.

This omission allowed roles without USAGE on a type to create
stored expressions that depend on it, which could prevent the owner
from changing the type later.

The checks deliberately live in the command paths rather than the
dependency-recording routines.  Those routines also run whenever
the server re-derives an existing expression, and re-checking there
would break routine maintenance for an owner who has since lost
USAGE on a type its objects already reference.  (Checking in the
dependency-recording routines would also require additional
CommandCounterIncrement() calls to avoid spurious errors.)

The addition of a parameter to AlterDomainAddConstraint() breaks
ABI compatibility, but we are unaware of any impacted third-party
code.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Security: CVE-2026-6470
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/424fb7160bc51d55c4be2023d9238f2db8807b35
Author: Nathan Bossart <nathan@postgresql.org>

Modified Files
--------------
src/backend/catalog/dependency.c         | 76 ++++++++++++++++++++++++++++++++
src/backend/catalog/heap.c               | 22 +++++++++
src/backend/catalog/index.c              |  3 ++
src/backend/catalog/pg_attrdef.c         |  3 ++
src/backend/catalog/pg_constraint.c      |  3 ++
src/backend/catalog/pg_proc.c            |  6 +++
src/backend/catalog/pg_publication.c     |  4 ++
src/backend/catalog/pg_type.c            |  6 +++
src/backend/commands/indexcmds.c         | 16 +++++++
src/backend/commands/policy.c            |  8 ++++
src/backend/commands/propgraphcmds.c     |  7 +++
src/backend/commands/statscmds.c         |  5 +++
src/backend/commands/tablecmds.c         | 19 +++++++-
src/backend/commands/trigger.c           |  5 +++
src/backend/commands/typecmds.c          | 33 +++++++++++---
src/backend/parser/parse_utilcmd.c       | 10 +++++
src/backend/rewrite/rewriteDefine.c      |  2 +
src/backend/tcop/utility.c               |  3 +-
src/include/catalog/dependency.h         |  4 ++
src/include/commands/typecmds.h          |  3 +-
src/test/regress/expected/privileges.out | 46 +++++++++++++++++++
src/test/regress/sql/privileges.sql      | 43 ++++++++++++++++++
22 files changed, 318 insertions(+), 9 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1wtQFn-00000000y5S-0JEd@gemulon.postgresql.org>
Permalink:  ../E1wtQFn-00000000y5S-0JEd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wtQFn-00000000y5S-0JEd@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Check for USAGE privilege on types used by stored expressions.
  In-Reply-To: <E1wtQFn-00000000y5S-0JEd@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox