pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: In extensions, don't replace objects not belonging to the extens
7+ messages / 1 participants
[nested] [flat]

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b9b21acc766db54d8c337d508d0fe2f5bf2daab0

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  49 +++++--
src/backend/catalog/pg_depend.c                    |  77 +++++++++--
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  16 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 539 insertions(+), 52 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cc7e0feba51b4aeb0adf9bdac659f83e9986b90d

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  49 +++++--
src/backend/catalog/pg_depend.c                    |  77 +++++++++--
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  16 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 539 insertions(+), 52 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5721da7e41e7a280587bda29cd1674c7da3317f8

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  49 +++++--
src/backend/catalog/pg_depend.c                    |  77 +++++++++--
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  16 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 539 insertions(+), 52 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7e92f78abe80e4b30e648a40073abb59057e21f8

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  49 +++++--
src/backend/catalog/pg_depend.c                    |  77 +++++++++--
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  18 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 540 insertions(+), 53 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5579726bd60a6e7afb04a3548bced348cd5ffd89

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  49 +++++--
src/backend/catalog/pg_depend.c                    |  74 +++++++++-
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  18 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 540 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f52d2fbd8c62f667191b61228acf9d8aa53607b9

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  46 +++++--
src/backend/catalog/pg_depend.c                    |  74 +++++++++-
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  18 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 537 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: In extensions, don't replace objects not belonging to the extens
@ 2022-08-08 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-08-08 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5919bb5a5989cda232ac3d1f8b9d90f337be2077

Modified Files
--------------
doc/src/sgml/extend.sgml                           |  11 --
src/backend/catalog/pg_collation.c                 |  46 +++++--
src/backend/catalog/pg_depend.c                    |  74 +++++++++-
src/backend/catalog/pg_operator.c                  |   2 +-
src/backend/catalog/pg_type.c                      |   7 +-
src/backend/commands/createas.c                    |  18 ++-
src/backend/commands/foreigncmds.c                 |  19 ++-
src/backend/commands/schemacmds.c                  |  25 +++-
src/backend/commands/sequence.c                    |   8 ++
src/backend/commands/statscmds.c                   |   4 +
src/backend/commands/view.c                        |  16 ++-
src/backend/parser/parse_utilcmd.c                 |  10 ++
src/include/catalog/dependency.h                   |   2 +
src/test/modules/test_extensions/Makefile          |   5 +-
.../test_extensions/expected/test_extensions.out   | 153 +++++++++++++++++++++
.../test_extensions/sql/test_extensions.sql        | 110 +++++++++++++++
.../test_extensions/test_ext_cine--1.0--1.1.sql    |  26 ++++
.../modules/test_extensions/test_ext_cine--1.0.sql |  25 ++++
.../modules/test_extensions/test_ext_cine.control  |   3 +
.../modules/test_extensions/test_ext_cor--1.0.sql  |  20 +++
.../modules/test_extensions/test_ext_cor.control   |   3 +
21 files changed, 537 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2022-08-08 15:13 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>
2022-08-08 15:13 pgsql: In extensions, don't replace objects not belonging to the extens Tom Lane <tgl@sss.pgh.pa.us>

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