git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 7e29a79) | patch
In extensions, don't replace objects not belonging to the extension.
Mon, 8 Aug 2022 15:12:31 +0000 (11:12 -0400)
Mon, 8 Aug 2022 15:12:31 +0000 (11:12 -0400)
commit b9b21acc766db54d8c337d508d0fe2f5bf2daab0
In extensions, don't replace objects not belonging to the extension.

Previously, if an extension script did CREATE OR REPLACE and there was
an existing object not belonging to the extension, it would overwrite
the object and adopt it into the extension. This is problematic, first
because the overwrite is probably unintentional, and second because we
didn't change the object's ownership. Thus a hostile user could create
an object in advance of an expected CREATE EXTENSION command, and would
then have ownership rights on an extension object, which could be
modified for trojan-horse-type attacks.

Hence, forbid CREATE OR REPLACE of an existing object unless it already
belongs to the extension. (Note that we've always forbidden replacing
an object that belongs to some other extension; only the behavior for
previously-free-standing objects changes here.)

For the same reason, also fail CREATE IF NOT EXISTS when there is
an existing object that doesn't belong to the extension.

Our thanks to Sven Klemm for reporting this problem.

Security: CVE-2022-2625
21 files changed:
doc/src/sgml/extend.sgml diff | blob | blame | history
src/backend/catalog/pg_collation.c diff | blob | blame | history
src/backend/catalog/pg_depend.c diff | blob | blame | history
src/backend/catalog/pg_operator.c diff | blob | blame | history
src/backend/catalog/pg_type.c diff | blob | blame | history
src/backend/commands/createas.c diff | blob | blame | history
src/backend/commands/foreigncmds.c diff | blob | blame | history
src/backend/commands/schemacmds.c diff | blob | blame | history
src/backend/commands/sequence.c diff | blob | blame | history
src/backend/commands/statscmds.c diff | blob | blame | history
src/backend/commands/view.c diff | blob | blame | history
src/backend/parser/parse_utilcmd.c diff | blob | blame | history
src/include/catalog/dependency.h diff | blob | blame | history
src/test/modules/test_extensions/Makefile diff | blob | blame | history
src/test/modules/test_extensions/expected/test_extensions.out diff | blob | blame | history
src/test/modules/test_extensions/sql/test_extensions.sql diff | blob | blame | history
src/test/modules/test_extensions/test_ext_cine--1.0--1.1.sql [new file with mode: 0644] blob
src/test/modules/test_extensions/test_ext_cine--1.0.sql [new file with mode: 0644] blob
src/test/modules/test_extensions/test_ext_cine.control [new file with mode: 0644] blob
src/test/modules/test_extensions/test_ext_cor--1.0.sql [new file with mode: 0644] blob
src/test/modules/test_extensions/test_ext_cor.control [new file with mode: 0644] blob
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /