pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reject extnamespace if it's temporary or it's '$user'::regnamesp
Date: Mon, 09 Nov 2026 14:21:53 +0000
Message-ID: <E1xQQFt-000000003Rt-2FE7@gemulon.postgresql.org> (raw)

Reject extnamespace if it's temporary or it's '$user'::regnamespace.

Historical behavior was bizarre.  'CREATE EXTENSION tcn SCHEMA "$user"'
set extnamespace='$user'::regnamespace, but the extension's object
landed in the schema named after the bootstrap superuser if such a
schema existed, else in pg_temp.  Many extension scripts failed, since
pg_temp is searched for only a subset of object types.  In other
scenarios, a trusted-extension script located the wrong object and
executed arbitrary SQL of a non-superuser's choice.  The prior commit's
locking additions could not cover this.  Back-patch to v14 (all
supported versions).

Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Greg Burd <greg@burd.me>
Backpatch-through: 14
Security: CVE-2026-6467

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4fea981a388e2a6e75ecfc66084c42e91fcde10f

Modified Files
--------------
src/backend/catalog/namespace.c                    | 13 +++++
src/backend/commands/extension.c                   | 36 ++++++++++---
.../test_extensions/expected/test_extensions.out   | 60 +++++++++++++++++-----
.../test_extensions/sql/test_extensions.sql        | 44 +++++++++++++---
4 files changed, 126 insertions(+), 27 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1xQQFt-000000003Rt-2FE7@gemulon.postgresql.org>
Permalink:  ../E1xQQFt-000000003Rt-2FE7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQFt-000000003Rt-2FE7@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com
  Subject: Re: pgsql: Reject extnamespace if it's temporary or it's '$user'::regnamesp
  In-Reply-To: <E1xQQFt-000000003Rt-2FE7@gemulon.postgresql.org>
  References: <E1xQQFt-000000003Rt-2FE7@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox