pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid using unsafe search_path settings during dump and restore. 6+ messages / 1 participants [nested] [flat]
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a8fc37a6381c0c2a5064d51aa31c72168c01a49a Modified Files -------------- src/backend/utils/adt/ruleutils.c | 50 +- src/bin/pg_dump/dumputils.c | 82 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 53 +- src/bin/pg_dump/pg_backup_archiver.h | 6 +- src/bin/pg_dump/pg_dump.c | 1658 +++++++++------------- src/bin/pg_dump/pg_dumpall.c | 36 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/rules.out | 78 +- src/test/regress/expected/triggers.out | 12 +- 12 files changed, 882 insertions(+), 1126 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/3d2aed664ee8271fd6c721ed0aa10168cda112ea Modified Files -------------- src/backend/utils/adt/ruleutils.c | 48 +- src/bin/pg_dump/dumputils.c | 100 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 53 +- src/bin/pg_dump/pg_backup_archiver.h | 4 +- src/bin/pg_dump/pg_dump.c | 1752 ++++++++-------------- src/bin/pg_dump/pg_dumpall.c | 34 +- src/bin/pg_dump/t/002_pg_dump.pl | 384 ++--- src/test/modules/test_pg_dump/t/001_base.pl | 50 +- src/test/regress/expected/collate.icu.utf8.out | 12 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/indexing.out | 98 +- src/test/regress/expected/rules.out | 78 +- src/test/regress/expected/triggers.out | 12 +- 16 files changed, 1166 insertions(+), 1492 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ REL9_3_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fe8b95b7ea0c6e4294c4c97c555bc7f3492c0e33 Modified Files -------------- src/backend/utils/adt/ruleutils.c | 51 +- src/bin/pg_dump/dumputils.c | 82 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 47 +- src/bin/pg_dump/pg_backup_archiver.h | 6 +- src/bin/pg_dump/pg_dump.c | 1610 +++++++++------------- src/bin/pg_dump/pg_dumpall.c | 36 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/rules.out | 148 +- src/test/regress/expected/triggers.out | 12 +- 12 files changed, 889 insertions(+), 1136 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b8a2908f0ac735da68d49be2bce2d523e363f67b Modified Files -------------- src/backend/utils/adt/ruleutils.c | 48 +- src/bin/pg_dump/dumputils.c | 100 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 53 +- src/bin/pg_dump/pg_backup_archiver.h | 4 +- src/bin/pg_dump/pg_dump.c | 1726 +++++++++------------- src/bin/pg_dump/pg_dumpall.c | 36 +- src/bin/pg_dump/t/002_pg_dump.pl | 376 ++--- src/test/modules/test_pg_dump/t/001_base.pl | 50 +- src/test/regress/expected/collate.icu.utf8.out | 12 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/rules.out | 78 +- src/test/regress/expected/triggers.out | 12 +- 15 files changed, 1113 insertions(+), 1415 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9f6e5296a15f541b04ecdfc077957ccaf2f6e49a Modified Files -------------- src/backend/utils/adt/ruleutils.c | 50 +- src/bin/pg_dump/dumputils.c | 82 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 53 +- src/bin/pg_dump/pg_backup_archiver.h | 6 +- src/bin/pg_dump/pg_dump.c | 1593 +++++++++------------- src/bin/pg_dump/pg_dumpall.c | 36 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/rules.out | 58 +- src/test/regress/expected/triggers.out | 12 +- 12 files changed, 842 insertions(+), 1081 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid using unsafe search_path settings during dump and restore. @ 2018-02-26 15:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-02-26 15:20 UTC (permalink / raw) To: pgsql-committers Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in schema "foo" could capture references meant to refer to pg_catalog entries, both in the queries issued by pg_dump and those issued during the subsequent restore run. That could result in dump/restore misbehavior, or in privilege escalation if a nefarious user installs trojan-horse functions or operators. This patch changes pg_dump so that it does not change the search_path dynamically. The emitted restore script sets the search_path to what was used at dump time, and then leaves it alone thereafter. Created objects are placed in the correct schema, regardless of the active search_path, by dint of schema-qualifying their names in the CREATE commands, as well as in subsequent ALTER and ALTER-like commands. Since this change requires a change in the behavior of pg_restore when processing an archive file made according to this new convention, bump the archive file version number; old versions of pg_restore will therefore refuse to process files made with new versions of pg_dump. Security: CVE-2018-1058 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/815172ba8068dbca9b585ed4aa975db00bef01d8 Modified Files -------------- src/backend/utils/adt/ruleutils.c | 45 +- src/bin/pg_dump/dumputils.c | 100 +- src/bin/pg_dump/dumputils.h | 6 +- src/bin/pg_dump/pg_backup.h | 3 + src/bin/pg_dump/pg_backup_archiver.c | 53 +- src/bin/pg_dump/pg_backup_archiver.h | 6 +- src/bin/pg_dump/pg_dump.c | 1660 +++++++++------------- src/bin/pg_dump/pg_dumpall.c | 36 +- src/bin/pg_dump/t/002_pg_dump.pl | 190 +-- src/test/modules/test_pg_dump/t/001_base.pl | 50 +- src/test/regress/expected/collate.linux.utf8.out | 12 +- src/test/regress/expected/collate.out | 12 +- src/test/regress/expected/rules.out | 78 +- src/test/regress/expected/triggers.out | 12 +- 14 files changed, 1002 insertions(+), 1261 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-02-26 15:20 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. Tom Lane <tgl@sss.pgh.pa.us> 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. Tom Lane <tgl@sss.pgh.pa.us> 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. Tom Lane <tgl@sss.pgh.pa.us> 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. Tom Lane <tgl@sss.pgh.pa.us> 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. Tom Lane <tgl@sss.pgh.pa.us> 2018-02-26 15:20 pgsql: Avoid using unsafe search_path settings during dump and restore. 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