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 1mDWXy-0002jT-Uh for pgsql-sql@arkaria.postgresql.org; Tue, 10 Aug 2021 18:32:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mDWXx-00025h-M0 for pgsql-sql@arkaria.postgresql.org; Tue, 10 Aug 2021 18:32:17 +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 1mDWXx-00025Z-FP for pgsql-sql@lists.postgresql.org; Tue, 10 Aug 2021 18:32:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDWXt-0005mI-0d for pgsql-sql@lists.postgresql.org; Tue, 10 Aug 2021 18:32:17 +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 17AIWA7V3825126; Tue, 10 Aug 2021 14:32:10 -0400 From: Tom Lane To: Ben Tilly cc: pgsql-sql@lists.postgresql.org Subject: Re: Is this a security oversight? In-reply-to: References: Comments: In-reply-to Ben Tilly message dated "Tue, 10 Aug 2021 10:41:48 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3825124.1628620330.1@sss.pgh.pa.us> Date: Tue, 10 Aug 2021 14:32:10 -0400 Message-ID: <3825125.1628620330@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ben Tilly writes: > As a security rule, you cannot create a cast without owning one of the > types. Check. > The following code successfully creates it, not as postgres and not as a > superuser. Really? When I try that as an ordinary user, I get ERROR: must be owner of type boolean CONTEXT: SQL statement "ALTER TYPE bool OWNER TO current_user" PL/pgSQL function inline_code_block line 12 at SQL statement If there is a way where that actually does work without superuser privileges, please send the details to security@postgresql.org. regards, tom lane