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 1sJzXI-007isI-4G for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jun 2024 17:55:56 +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 1sJzXF-003su8-Jn for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jun 2024 17:55:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJzXF-003stq-AR for pgsql-hackers@lists.postgresql.org; Wed, 19 Jun 2024 17:55:54 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJzX9-002VlA-LC for pgsql-hackers@postgresql.org; Wed, 19 Jun 2024 17:55:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 45JHtiPX139658; Wed, 19 Jun 2024 13:55:44 -0400 From: Tom Lane To: Jelte Fennema-Nio cc: Robert Haas , PostgreSQL-development Subject: Re: Extension security improvement: Add support for extensions with an owned schema In-reply-to: References: Comments: In-reply-to Jelte Fennema-Nio message dated "Wed, 19 Jun 2024 19:50:09 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <139656.1718819744.1@sss.pgh.pa.us> Date: Wed, 19 Jun 2024 13:55:44 -0400 Message-ID: <139657.1718819744@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jelte Fennema-Nio writes: > On Wed, 19 Jun 2024 at 17:28, Robert Haas wrote: >> I have a feeling that this might be pretty annoying to implement, and >> if that is true, then never mind. > Based on a quick look it's not trivial, but also not super bad. > Basically it seems like in src/backend/catalog/namespace.c, every time > we loop over activeSearchPath and CurrentExtensionObject is set, then > we should skip any item that's not stored in pg_catalog, unless > there's a DEPENDENCY_EXTENSION pg_depend entry for the item (and that > pg_depend entry references the extension or the requires list). We could change the lookup rules that apply during execution of an extension script, but we already restrict search_path at that time so I'm not sure how much further this'd move the goalposts. The *real* problem IMO is that if you create a PL function or (old-style) SQL function within an extension, execution of that function is not similarly protected. regards, tom lane