Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q8rmJ-0001MB-FI for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jun 2023 00:20:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q8rmI-0006zo-75 for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jun 2023 00:20:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q8rmH-0006ze-Tg for pgsql-committers@lists.postgresql.org; Tue, 13 Jun 2023 00:20:54 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q8rmF-001sXd-0q for pgsql-committers@lists.postgresql.org; Tue, 13 Jun 2023 00:20:52 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-65299178ac5so5416816b3a.1 for ; Mon, 12 Jun 2023 17:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20221208.gappssmtp.com; s=20221208; t=1686615650; x=1689207650; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=gznzyHc5050Ak5fbFBlQ/7VqSzrsJSeS4iif72neV5A=; b=25DeUAhbPQ8lYhPto8YJhKYBxiPivXwpKUibna+vo5QMWmPX9xbvBawFSVqCIxqV66 ARfqO+9gbLijQkoHXUDfAYUFvxHrA0qLlpq8Bojn35jYPFvh0fbXp0F26Dw0U9CkLD/J CwkQW46rtuywAos2CydFlhTKYDCHandxQXhE1aO08XQ+k/6T8FM5cV3KAR6uapX/BlfU drpXcCh2V0D9LerFPDUFsOYHtdBXQecOT9b9ItVdBbH8sMHe1kjVOHb722YEo8X6wvxn W+LuoW+0Hk7hAE1lhQEqwds63FOd1g/NforHKjYoG/a5PQb7in0DzuQ8438Sp3iQ6bFI wk5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686615650; x=1689207650; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gznzyHc5050Ak5fbFBlQ/7VqSzrsJSeS4iif72neV5A=; b=R8F/V7IQ3N8py2fNH7ZtQaAa2/+MA4d1T+bWr9e/a9wLNsSW3PiuqTBTJG+yof7Taz mW7SMhd3j0bF5nUIL4m3J1RkcSe3fmNPgT4Uf7U2H8lvdk+2qohMXZySU4o+lsU+5hbB HIa9RusrIv3ZUjonY3uBjjIGfkA/EhgSH3HI3P2o49WwLkDgknT7EUIQ9beyAjEYoJe2 JCZ/qykhpPUiKZS1Lhvv5w8djO2IRM+ux9T3Zg+u+mzD6TMz5VYAprVtCO1polRVzWz6 hjc8Xl6olv/Z5xIbw4zWEaJSTsd5pYxQPKQ7d595rt1o7ETrbmZIvnskJs6eH8FKBRgQ u5CA== X-Gm-Message-State: AC+VfDxbt6MVpscuXXVp8MH1theVWkcy6qzq3fny+6wl6/8t1FCYecaT STvlS71qJBR8cBuuM1R455gflg== X-Google-Smtp-Source: ACHHUZ7niGNJSGPhieCE/7Xg00qtcTtNJXyUYOu2MtrH+y3rvpyUxktk6tQgzIkvzJBQDFsOpQ7pjw== X-Received: by 2002:a05:6a00:15d6:b0:659:3031:5037 with SMTP id o22-20020a056a0015d600b0065930315037mr13676111pfu.3.1686615649893; Mon, 12 Jun 2023 17:20:49 -0700 (PDT) Received: from [172.24.1.9] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id d4-20020aa78e44000000b00662c4ca18ebsm197004pfr.128.2023.06.12.17.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 17:20:49 -0700 (PDT) Message-ID: <2985f969b292258ca007e9916839e2d07359ec15.camel@j-davis.com> Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations. From: Jeff Davis To: Robert Haas , Noah Misch Cc: Tom Lane , Jeff Davis , pgsql-committers@lists.postgresql.org Date: Mon, 12 Jun 2023 17:20:47 -0700 In-Reply-To: References: <89a415b86d5421941e4281ba5bf6288934078624.camel@j-davis.com> <573014.1686375211@sss.pgh.pa.us> <20230612170510.GA201972@gust.leadboat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2023-06-12 at 13:33 -0400, Robert Haas wrote: > I wonder why this commit used pg_catalog, pg_temp rather than just > the > empty string, as AutoVacWorkerMain does. I followed the rules here for "Writing SECURITY DEFINER Functions Safely": https://www.postgresql.org/docs/16/sql-createfunction.html which suggests adding pg_temp at the end (otherwise it is searched first by default). It's not exactly like a SECURITY DEFINER function, but running a maintenance command does switch to the table owner, so the risks are similar. I don't see a problem with the pg_temp schema in non-interactive processes, because we trust the non-interactive processes. Regards, Jeff Davis