postgresql/src
Tom Lane 3d2aed664e 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
2018-02-26 10:18:21 -05:00
..
backend Avoid using unsafe search_path settings during dump and restore. 2018-02-26 10:18:21 -05:00
bin Avoid using unsafe search_path settings during dump and restore. 2018-02-26 10:18:21 -05:00
common Update copyright for 2018 2018-01-02 23:30:12 -05:00
fe_utils Update copyright for 2018 2018-01-02 23:30:12 -05:00
include Add a new upper planner relation for partially-aggregated results. 2018-02-26 09:32:32 -05:00
interfaces Refactor client-side SSL certificate checking code 2018-01-30 22:56:24 -05:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Support parameters in CALL 2018-02-22 21:36:48 -05:00
port Add an assertion that we don't pass NULL to snprintf("%s"). 2018-02-14 15:06:01 -05:00
template Force "restrict" not to be used when compiling with xlc. 2017-10-13 12:15:06 -07:00
test Avoid using unsafe search_path settings during dump and restore. 2018-02-26 10:18:21 -05:00
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:42:28 -05:00
tools Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
tutorial Update copyright for 2018 2018-01-02 23:30:12 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:15 -08:00
Makefile.global.in Convert documentation to DocBook XML 2017-11-23 09:44:28 -05:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00