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 1q98lm-0004Hw-Ve for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jun 2023 18:29:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q98ll-0007Ku-BX for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jun 2023 18:29:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q98lk-0007Kl-TL for pgsql-committers@lists.postgresql.org; Tue, 13 Jun 2023 18:29:29 +0000 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q98lh-002BA3-TY for pgsql-committers@lists.postgresql.org; Tue, 13 Jun 2023 18:29:28 +0000 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-62dee846a0fso11095756d6.3 for ; Tue, 13 Jun 2023 11:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1686680964; x=1689272964; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=GClvoAKiwxbOvFSSqMJTUJdL4N9IAVqES8X+NMEHVfw=; b=PgGLRCTcO+VGRTrLH4stf+J3uSr6KAkEAab5aLGJj2xDSHvZcyu4FnXucyUZjicJ3j kfaZJa7/y0W8Np34/k1/SzmpAiVN7kiV1g7IWoLtg9l1w6+CYDTKTtK73dZ2SQKLemfb pvHGJvpYYQ+JdE0O12nW+JJQUb+zJmw6sGdhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686680964; x=1689272964; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GClvoAKiwxbOvFSSqMJTUJdL4N9IAVqES8X+NMEHVfw=; b=g3hnjvF/5b4XM3FY1Rkh3tCENI1MYg9PdbeQvmMnzW8iR+io3uC+HdLECN1VTUJLlh /DFXFakg1vTZcwGJE0orKwmstO9tTE9K+BqLq/MfeFKv1q8uXXEyrGgyZJCbc74r+tAY Q2vejQYQYNaLm+AL8ri5pRszBnALhiKAF2FYANMTgK9Tds2tTsnVUmhfBvg3PAie0kI6 HeIwdXBNGYwfQbaPHsnaq3f5Fz7ZO7rc4ChS9cQokuUFpay/JEBF3ZXVXq5oSwzsLjaS kHyrpbxHZuLpZ03KvFUWLWiRFa/DD4LAmMgHhZv+jUOqvgpe4Q2/37Ivvq1Fq6d1pW+A T8sQ== X-Gm-Message-State: AC+VfDxQWzCGsnxXwXsX8SvaU87Lcornby4n0uKwhob4NXl0Xmm29UUs 3lXIwXBQKkKjnmfDOPy4tf/Wrw== X-Google-Smtp-Source: ACHHUZ6OFm+82oyjEx6x/sF+qqyMJVfPFPOSPpu3I5mBjRegsGvrJ5mEEviE/KOuW3dUCv8S7Ki0iw== X-Received: by 2002:a05:6214:b6a:b0:62b:53b0:70b0 with SMTP id ey10-20020a0562140b6a00b0062b53b070b0mr9532641qvb.31.1686680963789; Tue, 13 Jun 2023 11:29:23 -0700 (PDT) Received: from gust.leadboat.com ([2605:59c8:21b1:8c10:d964:d902:15dd:792e]) by smtp.gmail.com with ESMTPSA id f9-20020a0cf3c9000000b0062de8c18f70sm1963640qvm.123.2023.06.13.11.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 11:29:23 -0700 (PDT) Date: Tue, 13 Jun 2023 14:29:20 -0400 From: Noah Misch To: Jeff Davis Cc: Tom Lane , Jeff Davis , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations. Message-ID: <20230613182920.GA259321@gust.leadboat.com> References: <89a415b86d5421941e4281ba5bf6288934078624.camel@j-davis.com> <573014.1686375211@sss.pgh.pa.us> <20230612170510.GA201972@gust.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jun 12, 2023 at 05:39:40PM -0700, Jeff Davis wrote: > On Mon, 2023-06-12 at 13:05 -0400, Noah Misch wrote: > > The timing was not great, but this is fixing a purported defect in an > > older > > v16 feature.  If the MAINTAIN privilege is actually fine, we're all > > set for > > v16.  If MAINTAIN does have a material problem that $SUBJECT had > > fixed, we > > should either revert MAINTAIN, un-revert $SUBJECT, or fix the problem > > a > > different way. > > Someone with the MAINTAIN privilege on a table can use search_path > tricks against the table owner, if the code is susceptible, because > maintenance code runs with the privileges of the table owner. > > I was concerned enough to bring it up on the -security list, and then > to -hackers followed by a commit (too late). But perhaps that was > paranoia: the practical risk is probably quite low, because a user with > the MAINTAIN privilege is likely to be highly trusted. > > I'd like to hear from others on the topic about the relative risks of > shipping with/without the search_path changes. I find shipping with the search_path change ($SUBJECT) to be lower risk overall, though both are fairly low-risk. Expect no new errors in non-FULL VACUUM, which doesn't run the relevant kinds of code. Tables not ready for the search_path change in ANALYZE already cause errors in Autovacuum ANALYZE and have since 2018-02 (CVE-2018-1058). Hence, $SUBJECT poses less compatibility risk than the CVE-2018-1058 fix. Best argument for shipping without $SUBJECT: we already have REFERENCES and TRIGGER privilege that tend to let the grantee hijack the table owner's account. Adding MAINTAIN to the list, while sad, is defensible. I still prefer to ship with $SUBJECT, not without.