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 1ntbcD-0003mi-Pw for pgsql-hackers@arkaria.postgresql.org; Tue, 24 May 2022 20:58:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntbcC-0000XP-Dx for pgsql-hackers@arkaria.postgresql.org; Tue, 24 May 2022 20:58:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntbcB-0000XC-Ux for pgsql-hackers@lists.postgresql.org; Tue, 24 May 2022 20:58:52 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ntbc5-0000Bb-Cg for pgsql-hackers@postgresql.org; Tue, 24 May 2022 20:58:50 +0000 Received: by mail-pf1-x430.google.com with SMTP id 202so10480348pfu.0 for ; Tue, 24 May 2022 13:58:45 -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:content-transfer-encoding:in-reply-to; bh=zDE4CUjj6gIXhwDlmCRf7VjYRN7sA3IHCkeVhkl7Xk4=; b=IBWIL+2u7VGt1TNZLaszvTm+aKajUSELGiznkqgLiDsCsB1KgOk8VV6r86OE5Bt0O3 +9QGnjamlq+dtRMVcZlwuqMIR621ULnVxCGanGJL9brJRUedu/HRKPqbrW9ytdu1l2KK 8uqySum7Ymly7m2k0jF09Dhj0avUJs5fIXQwIVekDKjReg+F9jvBc3XPVOuH9H0PM2TQ 92tPzWHxRBK5sr+kOQQwBJPa+fiDEUgbJb3Rh5ff2VRqi+45gRZbJtACTBs99neETApV ou5EBQhxbif40dzmKMEU+mwIbbO76tJA7bXEQuQ2T2agR0ucctdFOgAuKe1cRSWUakvb gSuQ== 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:content-transfer-encoding :in-reply-to; bh=zDE4CUjj6gIXhwDlmCRf7VjYRN7sA3IHCkeVhkl7Xk4=; b=ROuGAw9kJsFu+Bbq49zZBGNXEFynNA0iDmMGCduFzFjjmnzw3kvUQs/D5Ugc3HperZ 2H634QntAHFV0oA9exAV8Z4rwIsI5TCaBoYruXH0BA5Bbk6HjNZ4iTbuWvO3uSqcCH3k xzqsGB3q7b3s3u7PAKNm3QJ1vv8QOfEgSiFGVVKdalyXdgOXnTqvsCWICT6jFRViqC9m tTiA7Jtain7/CHByUoQdjLWAcu3v50fsz5Nx123bp70B8EXMuK1o4u+QFcoQP0OSBox4 BBNGK4JA0bR1b4Kw8T0vxN5wdVt8yebt2orYxEbD05huS9Lm88LRQ0wQ1kUy/ykVVmYJ aQcw== X-Gm-Message-State: AOAM531bJUKUvJpKtqNcDHDQ/TxFYPjOeeiQPwGxi1FoyyR4zS77q5eS NkiZCy0MaqQdrbkoISqvW7I= X-Google-Smtp-Source: ABdhPJzaX9PBCTHAdjwamYzX+pbEODb1Op1zCbEyFrRvft9py59UECx4efgdm7J7bdimRjY4MmlfeQ== X-Received: by 2002:a05:6a00:2281:b0:518:cfd2:5020 with SMTP id f1-20020a056a00228100b00518cfd25020mr3928955pfe.20.1653425924097; Tue, 24 May 2022 13:58:44 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id p10-20020a17090a428a00b001dd16b86fc0sm230055pjg.19.2022.05.24.13.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 13:58:43 -0700 (PDT) Date: Tue, 24 May 2022 13:58:41 -0700 From: Nathan Bossart To: Robert Haas Cc: Tom Lane , "pgsql-hackers@postgresql.org" Subject: Re: allow building trusted languages without the untrusted versions Message-ID: <20220524205841.GA1254661@nathanxps13> References: <571753.1653092411@sss.pgh.pa.us> <20220523165403.GC938919@nathanxps13> <1290329.1653326228@sss.pgh.pa.us> <1333860.1653338790@sss.pgh.pa.us> <1354561.1653345768@sss.pgh.pa.us> <20220524172851.GA1191690@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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 Tue, May 24, 2022 at 02:10:19PM -0400, Robert Haas wrote: > I guess one question is at what level we want to disable these various > things. Your original proposal seemed reasonable to me because I feel > like users who are compiling PostgreSQL ought to have control over > which things they compile. If you can turn plperl and plperlu off > together, and you can, then why shouldn't you be able to turn them on > and off separately? I can't think of a good reason why we shouldn't > make that possible if people want it, and evidently at least one > person does: you. I'm even willing to assume that you represent the > interests of some larger group of people. :-) :) FWIW this was my original thinking. I can choose to build/install extensions separately, but when it comes to PL/Tcl and PL/Perl, you've got to build the trusted and untrusted stuff at the same time, and the untrusted symbols remain even if you remove the control file and installation scripts. Of course, this isn't a complete solution for removing the ability to do any sort of random file system access, though. > But it's not evident to me that it's useful to disable everything > specifically at compile time. I have long thought that it's pretty > bizarre that we permit DML on system catalogs even with > allow_system_table_mods=off, and if I were going to provide a way to > lock that down, I would think of doing it via a new GUC, or a > modification to the existing GUC, or something like that, rather than > a compile-time option -- because we might easily discover a problem in > a future release that requires catalog DML to fix, and you wouldn't > want to have to replace the binaries or even bounce the server to do > that. Yeah, for certain things, a GUC probably makes more sense. > And similarly, is it really want we want here to categorically disable > all functions that permit file access for all users under all > circumstances? Or do we maybe want that to be something that can be > reconfigured at runtime? Or even just make it a privilege extended to > some users but not others? What about COPY TO/FROM PROGRAM? I guess I'd ask again whether we can do both... We've got predefined roles like pg_execute_server_program that allow access to COPY TO/FROM PROGRAM, but I have no way to categorically disable that ѕort of thing if I wanted to really lock things down, even for superusers. I'm not suggesting that every predefined role needs a corresponding configure option, but basic things like arbitrary disk/network/program access seem like reasonable proposals. I have about 50% of a generic --disable-disk-access patch coded up which I'll share soon to help inform the discussion. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com