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 1ntBJw-0007if-Dz for pgsql-hackers@arkaria.postgresql.org; Mon, 23 May 2022 16:54:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntBJu-0006Rc-Uf for pgsql-hackers@arkaria.postgresql.org; Mon, 23 May 2022 16:54:14 +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 1ntBJu-0006QP-JT for pgsql-hackers@lists.postgresql.org; Mon, 23 May 2022 16:54:14 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ntBJp-0007Bu-Qk for pgsql-hackers@postgresql.org; Mon, 23 May 2022 16:54:14 +0000 Received: by mail-pj1-x1036.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so2720907pjt.4 for ; Mon, 23 May 2022 09:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=j+fCc0laq0ATfDvj3uicB9lmrPF3WvoQCX+F5zGIpsw=; b=dYXKYscDS1nYvLQ0CsBQUQZHDDj08cbhrnTlRuURBKXJrxVlzQ98GS+tLjQt0fb35I xE2fNS7mtR486RAUISxKsHgyedHIh6Yecuap1HBM+J2csBTa/Uh5kZY2VPKV5MK1j7Tg vEJwSk1SW8C5TOV3/TzBwXeOxHMgrYMEtV/ms42/im0hLTgWfluXifEql5naRRI2QniC CCCt7p/RRwJEoLrvnN/ikNlslNfRbIA3fgkNyH8ArzFixydpskBMiIU/dYzaLeCaaKMR 97spIMOYIykfGQa0ke2kJNtcuqOcEa/TqxuufvPXiQw+++h8m98UOjmiPCTs6VirHujx eNUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=j+fCc0laq0ATfDvj3uicB9lmrPF3WvoQCX+F5zGIpsw=; b=gtc6QF2X05zUIalEfbGScw1mX4lyS2xsG4jN1oj8ny4De0ZP4QnoNKusM5s25pGg0c /Rq+4a3GCDHea26VwCo0Xk8WonbDea3xMlT3BMU+2QaPCs5hkiaFfvFpeKhSlr3sCasZ U/0MWTzU4UqfUb9VKn2dkrHcf0d2tqCP47htQSSR0FjA/nGzZoY4jsPjurI7KL+KDiaf +ylt2ijMJ5YjOb9pUNnruabmxiy5w7ovIhHf+uDEX7z0bBbhvTnAhOlZt4fY6wPSqGxg GwgK/ZOQ+4wQAtJs5mZglS4/BTVDVfXL6O8qYykib8ItqpuAt241QVqMAw/5/40KhPYp 86OQ== X-Gm-Message-State: AOAM532SPwIU4WYqOq2dj8VPyfXf0InJwfDRJSOJkySI4qB3M/2FkfEn gjzvYnDGCg/PDsOemjox8TEOw027PDY= X-Google-Smtp-Source: ABdhPJz9Bb111zwSnglqnknpTgTwQwrxASHdLuE22qdYfVSAaN4FiBFxOscGkU7DruB22qfV6bHHBA== X-Received: by 2002:a17:902:d64d:b0:162:3595:220c with SMTP id y13-20020a170902d64d00b001623595220cmr2066896plh.10.1653324847499; Mon, 23 May 2022 09:54:07 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id p12-20020a170902eacc00b0015e8d4eb288sm5366096pld.210.2022.05.23.09.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 09:54:06 -0700 (PDT) Date: Mon, 23 May 2022 09:54:03 -0700 From: Nathan Bossart To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: allow building trusted languages without the untrusted versions Message-ID: <20220523165403.GC938919@nathanxps13> References: <20220520225619.GA876272@nathanxps13> <571753.1653092411@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <571753.1653092411@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, May 20, 2022 at 08:20:11PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> Presently, if you want to only build trusted PL/Perl and PL/Tcl, you need >> to make a couple of code changes to compile out the untrusted parts. I >> suspect many users (e.g., anyone who wants to disallow file system access) >> would benefit from a better supported way to do this. Thus, I've attached >> some patches that introduce an optional argument for the --with-perl and >> --with-tcl configuration options. This new argument can be used to build >> only the trusted or untrusted version of the language. If the argument is >> not provided, both the trusted and untrusted versions are built, so this >> change is backward compatible. > > I do not believe that this is worth the extra complication. Nobody has > ever asked for it before, so I estimate the number of people who would > use it as near zero, and those folk are entirely capable of removing > the relevant extension files from their installations. Of course, if there is no interest in this feature, I'll withdraw the patch from consideration. However, I will note that moving the extension files aside is not sufficient for blocking all use of untrusted languages, since the symbols for their handler/validator functions will still be present. > Moreover, if we accept this as a useful configure option, what other > things will we be called on to change? It surely makes no sense to > install contrib/adminpack, for instance, if you're afraid of having > plperlu installed. > > Lastly, you've offered no reason to think this would provide any real > security improvement. Someone who's gained the ability to issue CREATE > EXTENSION on untrusted extensions has already got all the privileges he > needs; leaving out a few extension files is at most going to slow him > down a bit on the way to full filesystem access. (See, eg, COPY TO > PROGRAM.) I'd like to provide the ability to disallow these other things, too. This is intended to be a first step in that direction. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com