postgresql/src/backend/catalog
Tom Lane 5721da7e41 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
2022-08-08 11:12:31 -04:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
aclchk.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
catalog.c Message style improvements 2021-06-28 08:36:44 +02:00
Catalog.pm Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
dependency.c Fix omissions in support for the "regcollation" type. 2022-07-17 17:43:28 -04:00
genbki.pl Pre branch pgindent / pgperltidy run 2021-06-28 11:05:54 -04:00
heap.c Ensure that slots are zeroed before use 2021-10-26 10:40:08 +02:00
index.c Make relation-enumerating operations be security-restricted operations. 2022-05-09 08:35:12 -07:00
indexing.c Fix comment in indexing.c 2021-03-17 18:07:00 +09:00
information_schema.sql Add DISTINCT to information schema usage views 2021-04-21 11:54:47 +02:00
Makefile Split function definitions out of system_views.sql into a new file. 2021-04-16 18:37:02 -04:00
namespace.c Fix temporary object cleanup failing due to toast access without snapshot. 2022-02-21 09:57:05 -08:00
objectaccess.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
objectaddress.c Fix lookup error in extended stats ownership check 2021-08-31 18:36:06 +02:00
partition.c ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
pg_aggregate.c Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
pg_cast.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_collation.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_constraint.c Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
pg_conversion.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_db_role_setting.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_depend.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_enum.c Rename "enum blacklist" to "uncommitted enums". 2021-01-05 12:38:48 +13:00
pg_inherits.c Message style improvements 2021-06-28 08:36:44 +02:00
pg_largeobject.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_namespace.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_operator.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_proc.c Fix missed lock acquisition while inlining new-style SQL functions. 2021-08-31 12:02:36 -04:00
pg_publication.c Fix double publish of child table's data. 2021-12-09 08:49:50 +05:30
pg_range.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_shdepend.c Avoid leaking memory during large-scale REASSIGN OWNED BY operations. 2021-12-01 13:44:47 -05:00
pg_subscription.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pg_type.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
sql_feature_packages.txt Cleanup in SQL features files 2020-03-28 08:46:18 +01:00
sql_features.txt Fix use of cursor sensitivity terminology 2021-04-07 08:05:55 +02:00
storage.c Rethink the delay-checkpoint-end mechanism in the back-branches. 2022-04-14 11:10:07 -04:00
system_functions.sql Remove pg_wait_for_backend_termination(). 2021-06-14 17:29:37 -07:00
system_views.sql Fix incorrect permissions on pg_subscription. 2021-06-03 14:54:06 -04:00
toasting.c Fix toast rewrites in logical decoding. 2021-08-25 10:10:50 +05:30