Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hksMQ-0004c3-3B for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 15:48:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hksMO-0002yv-Tw for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 15:48:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hksMO-0002yo-Iq for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 15:48:52 +0000 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hksML-0008R5-AH for pgsql-general@postgresql.org; Tue, 09 Jul 2019 15:48:52 +0000 Received: by mail-ot1-x344.google.com with SMTP id x21so20371485otq.12 for ; Tue, 09 Jul 2019 08:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=J+xBlPc0To/rImApKXqWBVXJrV6yFJ6H4zmIpNgxUjM=; b=Zc8cD5KvxRTVF12MnbChTntwtdqkfSqC3hEJgkC8UDMtKDpEToI4mOpMHZR88jOQUQ wKlfQIUoTw5G61yml32qbQ9apinOK9yBej8J7rUL1bS86Zl7OmT/QNjj/L19I5tzzxOb I6S9oahuPRxqDXQ+uBXQ6BYOYBWUp8rpSuP67xyE6fTGJplHRAmhl/lowWbk0lDAXEq5 LgGHFAptv3ZUU9xhSnYupEwuheD5NvuKY3fCRV6kcZbEbYZiKIfijFw6jyN35Qmn8qIn 5vH+fPS/iWdM5ApwhmWdp9RCkDTY8+j5NoXeqrpJJzfCxnCxUjChTL9UfDJxrOYMtRm6 A23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=J+xBlPc0To/rImApKXqWBVXJrV6yFJ6H4zmIpNgxUjM=; b=CZuvXNyPIjZZAdVTdYp+b21cmtwu0LJ3QxPZ/qkFAbET72ch9TDVaEHZK1I0iItXh+ 17XiVHBhM+/++nBux1cZBDBt3H6H+wLnvmjzDys/WTsZofGn2clgjooODnpT87ZhbUWB 0ZIw3FuoA5pEmcWrUitDV7EyvJ8m9MSs8Aik0PEvUi7V0YvIPB2kSSfRwB0qVYnh3sXi rFE5AtezSNn27lUeQ2Dz5duAZmQlV/63sfyTNOOBjJS3omb8Bjqo6POemSZElCX611kV G/r2F+z0eAjw1N70hSu3bGrwQ0ciUhNba/J8wbT+lGZZ2PFMfBY761W/bLxxzn6GtO82 FQtQ== X-Gm-Message-State: APjAAAWHaoL70qZnfgQ1sbmIgcS2qMAkdRH3O8CJJ+FVvPGJg8l3x+I5 rVKXXciVw3w5XQX49TaQ8ZlyIq0zlcaA6g== X-Google-Smtp-Source: APXvYqwURPntvd56qyr7sTgsybUdiix4S8azV4tHeEfKgV+JheaZSyMR89Xrzj0VrTzHKgCITjJm7g== X-Received: by 2002:a9d:6d8d:: with SMTP id x13mr6266852otp.6.1562687326808; Tue, 09 Jul 2019 08:48:46 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:e4a2:d970:b88f:f5fa? ([2600:1700:4000:8120:e4a2:d970:b88f:f5fa]) by smtp.googlemail.com with ESMTPSA id p126sm7445708oia.10.2019.07.09.08.48.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 08:48:46 -0700 (PDT) Subject: Re: pg_dump and search_path To: "David G. Johnston" Cc: Adrian Klaver , pgsql-general References: <1f5111a5-e49e-e44a-67df-b367e5d31fdf@lucee.org> <94e28e8c-e5cf-f0b5-a148-43452446d9ec@aklaver.com> From: "Igal @ Lucee.org" Message-ID: <7dab1f15-0602-1350-23f7-1b01f2d36e45@lucee.org> Date: Tue, 9 Jul 2019 08:48:44 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------1E92C834870EBF3B8E5C7F9A" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------1E92C834870EBF3B8E5C7F9A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit David, On 7/9/2019 7:49 AM, David G. Johnston wrote: > On Tue, Jul 9, 2019 at 7:41 AM Igal @ Lucee.org > wrote: > > search_path is not set int he config, but rather with ALTER > DATABASE SET > search_path TO ... but I have executed that prior to the RESTORE > on the > target database.  Would it make a difference if I set it in the > config? > > > What is your restore command then?  Because if you are dropping and > recreating the same named database the ALTER DATABASE SET command is > going to be lost with the drop since it is associated to an OID and > not just the name.  By placing the search_path into postgres.conf you > avoid that issue altogether. The restore command is: pg_restore.exe --verbose --single-transaction -h -p -d -U postgres But how will I avoid the issue if the command  `SELECT pg_catalog.set_config('search_path', '', false);` is part of the pgdump file?  Wouldn't that override the config file setting during the restore process? > But, yes, objects saved to the database should usually have schema > qualifications (which gets a bit messy with custom operators).  > search_path reliance should probably be reserved to interactive use or > at worse client supplied queries. In my case I use a separate Postgres cluster for each database and the roles, absent of any successful hacking, are all limited to trusted users, so the risk mentioned in the CVE is non-existent and it would be great if there was an option to turn off that "feature". Thanks, Igal --------------1E92C834870EBF3B8E5C7F9A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

David,

On 7/9/2019 7:49 AM, David G. Johnston wrote:

On Tue, Jul 9, 2019 at 7:41 AM Igal @ Lucee.org <igal@lucee.org> wrote:
search_path is not set int he config, but rather with ALTER DATABASE SET
search_path TO ... but I have executed that prior to the RESTORE on the
target database.  Would it make a difference if I set it in the config?

What is your restore command then?  Because if you are dropping and recreating the same named database the ALTER DATABASE SET command is going to be lost with the drop since it is associated to an OID and not just the name.  By placing the search_path into postgres.conf you avoid that issue altogether.

The restore command is:

pg_restore.exe --verbose --single-transaction -h <ip> -p <port> -d <dbname> -U postgres <path-to-pgdump-file>

But how will I avoid the issue if the command  `SELECT pg_catalog.set_config('search_path', '', false);` is part of the pgdump file?  Wouldn't that override the config file setting during the restore process?

But, yes, objects saved to the database should usually have schema qualifications (which gets a bit messy with custom operators).  search_path reliance should probably be reserved to interactive use or at worse client supplied queries.

In my case I use a separate Postgres cluster for each database and the roles, absent of any successful hacking, are all limited to trusted users, so the risk mentioned in the CVE is non-existent and it would be great if there was an option to turn off that "feature".

Thanks,

Igal

--------------1E92C834870EBF3B8E5C7F9A--