pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent creating types in pg_temp from restricted code. 3+ messages / 1 participants [nested] [flat]
* pgsql: Prevent creating types in pg_temp from restricted code. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent creating types in pg_temp from restricted code. Commit 62aba76568 taught security-restricted operations to refuse temporary table creation, since the calling session might not expect untrusted objects to appear at the front of its search path, but the same hazard exists for types. This oversight allowed code running within such an operation to create domains, enum types, and range types in the session's temporary schema, potentially leading to privilege escalations. To fix, refuse to create these types in a temporary schema within a security-restricted operation, as we already do for tables. The checks live in the command paths rather than in TypeCreate(), which also creates the rowtypes of the transient relations that REFRESH MATERIALIZED VIEW CONCURRENTLY and rewrites of temporary tables legitimately place in pg_temp within a security-restricted operation. Composite types are already covered by the existing check in DefineRelation(), and creating base or shell types requires superuser. Other object kinds are left alone, since unqualified names never resolve to them in pg_temp. Reported-by: Anthropic OSS program Author: Anthropic OSS program Co-authored-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Greg Burd <greg@burd.me> Security: CVE-2026-116316 Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/91ede1768834d07e0751dbc3efae9ece18f92f44 Author: Nathan Bossart <nathan@postgresql.org> Modified Files -------------- src/backend/commands/typecmds.c | 24 ++++++++++++++++++++++++ src/test/regress/expected/privileges.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/privileges.sql | 18 ++++++++++++++++++ 3 files changed, 67 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Prevent creating types in pg_temp from restricted code. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent creating types in pg_temp from restricted code. Commit 62aba76568 taught security-restricted operations to refuse temporary table creation, since the calling session might not expect untrusted objects to appear at the front of its search path, but the same hazard exists for types. This oversight allowed code running within such an operation to create domains, enum types, and range types in the session's temporary schema, potentially leading to privilege escalations. To fix, refuse to create these types in a temporary schema within a security-restricted operation, as we already do for tables. The checks live in the command paths rather than in TypeCreate(), which also creates the rowtypes of the transient relations that REFRESH MATERIALIZED VIEW CONCURRENTLY and rewrites of temporary tables legitimately place in pg_temp within a security-restricted operation. Composite types are already covered by the existing check in DefineRelation(), and creating base or shell types requires superuser. Other object kinds are left alone, since unqualified names never resolve to them in pg_temp. Reported-by: Anthropic OSS program Author: Anthropic OSS program Co-authored-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Greg Burd <greg@burd.me> Security: CVE-2026-116316 Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9c4d55de4a43f744c59465baadc1e976f2fb2716 Author: Nathan Bossart <nathan@postgresql.org> Modified Files -------------- src/backend/commands/typecmds.c | 24 ++++++++++++++++++++++++ src/test/regress/expected/privileges.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/privileges.sql | 18 ++++++++++++++++++ 3 files changed, 67 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Prevent creating types in pg_temp from restricted code. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent creating types in pg_temp from restricted code. Commit 62aba76568 taught security-restricted operations to refuse temporary table creation, since the calling session might not expect untrusted objects to appear at the front of its search path, but the same hazard exists for types. This oversight allowed code running within such an operation to create domains, enum types, and range types in the session's temporary schema, potentially leading to privilege escalations. To fix, refuse to create these types in a temporary schema within a security-restricted operation, as we already do for tables. The checks live in the command paths rather than in TypeCreate(), which also creates the rowtypes of the transient relations that REFRESH MATERIALIZED VIEW CONCURRENTLY and rewrites of temporary tables legitimately place in pg_temp within a security-restricted operation. Composite types are already covered by the existing check in DefineRelation(), and creating base or shell types requires superuser. Other object kinds are left alone, since unqualified names never resolve to them in pg_temp. Reported-by: Anthropic OSS program Author: Anthropic OSS program Co-authored-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Greg Burd <greg@burd.me> Security: CVE-2026-116316 Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/448db14518504c789554f2e1be5a1efa6a9b155c Author: Nathan Bossart <nathan@postgresql.org> Modified Files -------------- src/backend/commands/typecmds.c | 24 ++++++++++++++++++++++++ src/test/regress/expected/privileges.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/privileges.sql | 18 ++++++++++++++++++ 3 files changed, 67 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-11-09 14:21 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-09 14:21 pgsql: Prevent creating types in pg_temp from restricted code. Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Prevent creating types in pg_temp from restricted code. Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Prevent creating types in pg_temp from restricted code. Noah Misch <noah@leadboat.com>
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