Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdd8J-006ax3-5W for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Feb 2024 21:31:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rdd8G-0032mQ-IX for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Feb 2024 21:31:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdd8G-0032mH-96 for pgsql-hackers@lists.postgresql.org; Fri, 23 Feb 2024 21:31:00 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rdd8C-000f26-Jf for pgsql-hackers@postgresql.org; Fri, 23 Feb 2024 21:30:59 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3650dcd38a0so2471805ab.1 for ; Fri, 23 Feb 2024 13:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708723857; x=1709328657; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HHvBtRMHIIJqSs0zlWglus7zneoZ6hjsc7jwZ83eOpI=; b=jiYwhXhftJlYflh+lx18O3bRrLdmMVIpdEhIIQfRBquEHgFv+nlWEKhjGcduqgFv9A y7/lPKNdPPRSxTXkK3o14NEvYU5Uc6+If1bqb284J5CpbB9lK5oXopZsztN9G/8maXQZ BN4k7u4ywBeVKxi3jcMoliEiNEsxmC9lRYfxRegHqtjFnve2E33pYXn4wB7K4cfGGbTV wsxrDPDklGK0tSVZzlT6jJ/Byc6JLs7mZa20bMvmCbtuuVYbUjQ18bBIOtJgttuJbBC1 mQR3CijfX3eLyNDbYxdZQEJSrSsl2WmCx+CnhKs4DRkRy0W29q8UD4EWgNAhsdSkJwiN CCqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708723857; x=1709328657; h=in-reply-to: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=HHvBtRMHIIJqSs0zlWglus7zneoZ6hjsc7jwZ83eOpI=; b=ZaXKPO5XNgJH8ddLcc7wGMczkhP7LHuB0iGQU8xV6bwlvtjkP05PeuLHzgKqxgXjF1 /Nyo6QeeaiGJYKbD0tBfQIpGilYCmvreCct8sD3MxRNml3S/NIoPThUb59sHnX6xwZeh hJJmCukBumxJRrNcO75EM9Ze+qW6ZghQX7zM8vikn9NBnb9Yu/km7xmUL9ZKwNY17ofv G37ctjkalHQ3UFPpDladHD+H8k+9BdydPkvbyuENLf5LVxd2IHlx9wwFuxzimwpG31XR K4ke4vHo8LcMa+j3+g8ETCB1KGixuQQYbR/ttDTlL2sEcoH3oAAf/X4kLjKazIzqvIq9 2/FA== X-Gm-Message-State: AOJu0YyL/ctOrHlE0850XSdFJ2B9IXeeHYDP5oW220Aue5GF1G26eOfB uoLaEELNinPLUaDOUyMFk+JVaZd6mjoJxG4fhGSNpgc4rp8PmHto X-Google-Smtp-Source: AGHT+IHnSEng4ThG3cIj7T39iWdPr083DtOGFOyXFL5MVcNkzw9vc6+260CiD1842/nRYbent/iK4A== X-Received: by 2002:a05:6e02:1a0a:b0:365:4e45:658f with SMTP id s10-20020a056e021a0a00b003654e45658fmr1409230ild.22.1708723857120; Fri, 23 Feb 2024 13:30:57 -0800 (PST) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id x8-20020a92d308000000b0036576c9ea6esm602143ila.42.2024.02.23.13.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:30:56 -0800 (PST) Date: Fri, 23 Feb 2024 15:30:55 -0600 From: Nathan Bossart To: Jeff Davis Cc: pgsql-hackers@postgresql.org, Joe Conway , Robert Haas Subject: Re: MAINTAIN privilege -- what do we need to un-revert it? Message-ID: <20240223213055.GA1805646@nathanxps13> References: <20240214190226.GA373350@nathanxps13> <4d497d82e4516037dc1082d5a62d199ea00d62e7.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d497d82e4516037dc1082d5a62d199ea00d62e7.camel@j-davis.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk (Apologies in advance for anything I'm bringing up that we've already covered somewhere else.) On Fri, Feb 16, 2024 at 04:03:55PM -0800, Jeff Davis wrote: > Note the changes in amcheck. It's creating functions and calling those > functions from the comparators, and so the comparators need to set the > search_path. I don't think that's terribly common, but does represent a > behavior change and could break something. Why is this change needed? Is the idea to make amcheck follow the same rules as maintenance commands to encourage folks to set up index functions correctly? Or is amcheck similarly affected by search_path tricks? > void > InitializeSearchPath(void) > { > + /* Make the context we'll keep search path cache hashtable in */ > + SearchPathCacheContext = AllocSetContextCreate(TopMemoryContext, > + "search_path processing cache", > + ALLOCSET_DEFAULT_SIZES); > + > if (IsBootstrapProcessingMode()) > { > /* > @@ -4739,11 +4744,6 @@ InitializeSearchPath(void) > } > else > { > - /* Make the context we'll keep search path cache hashtable in */ > - SearchPathCacheContext = AllocSetContextCreate(TopMemoryContext, > - "search_path processing cache", > - ALLOCSET_DEFAULT_SIZES); > - What is the purpose of this change? > + SetConfigOption("search_path", GUC_SAFE_SEARCH_PATH, PGC_USERSET, > + PGC_S_SESSION); I wonder if it's worth using PGC_S_INTERACTIVE or introducing a new value for these. > +/* > + * Safe search path when executing code as the table owner, such as during > + * maintenance operations. > + */ > +#define GUC_SAFE_SEARCH_PATH "pg_catalog, pg_temp" Is including pg_temp actually safe? I worry that a user could use their temporary schema to inject objects that would take the place of non-schema-qualified stuff in functions. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com