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 1lXDSx-00054B-QK for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Apr 2021 01:40:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lXDSv-0004lz-PJ for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Apr 2021 01:40:13 +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 1lXDSv-0004lr-Aj for pgsql-hackers@lists.postgresql.org; Fri, 16 Apr 2021 01:40:13 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lXDSr-0001wD-KF for pgsql-hackers@lists.postgresql.org; Fri, 16 Apr 2021 01:40:12 +0000 Received: by mail-pj1-x102e.google.com with SMTP id lt13so4222444pjb.1 for ; Thu, 15 Apr 2021 18:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VIOaXQvJafJjYjUcyXeLwcX2bUKCDw+hMvLUco6XPhk=; b=bUmy3sZHKa3vwrjWUvcl2zkxjoXPwR8CKCSR9i+DFPias4DolZ/LIyuD4pqy9goGpG Rs/2ENtfeyn600+r+65QPrMC2eTdif+w4y+gPYXPPF21tg72FihfqF/9voa7yuNyKrnt SSWwlgAnsePZqZI6JSCymbL7i6Vsa7GyRy1b8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VIOaXQvJafJjYjUcyXeLwcX2bUKCDw+hMvLUco6XPhk=; b=OXcjNFXvgcUpqh4TnIElEMZYjclsTc71UHN2v1KZ3v94/y901SYtk+5cQMJexoxsUH oblL9DepTI575VOJdCQjV0hH3YgPWJvVG0bubt8Ay7uLZH6+HqGBgOlXOKdQs39fT2a4 QMAmedYT6bEKgW5XSuOL5O7CPfmUOhctc711QSWCwqicoA9z5r7CgbuELTS9L99crIrY oD2CxKskFoms8lXxveYThP7dwvbETU6z4TQoRi2FhyiK/LINmHWkWRkSdeopyEb2jdNa r1P2k0IQDAFi4SgHYDbQMTzhvYeU5HkVN9ElVaYBV0it+lKA6irXGCdhP4uCcD2EKavy CvGw== X-Gm-Message-State: AOAM5328dA5b7cpy5R2W7T0qNJa31jvHUNkYFlSMYcu33ZZ5o2QZYKxu 3T+9RpxQDMoWi38yQy56X9YmDA== X-Google-Smtp-Source: ABdhPJz4R0g3HPu3cax5s+1GX1HBfF+X+/grwBMbkABBJgzf0XNTduCW5D2n/sKd34rkuQ7x2k4tiQ== X-Received: by 2002:a17:902:c411:b029:e9:3d37:afc with SMTP id k17-20020a170902c411b02900e93d370afcmr7021236plk.17.1618537207132; Thu, 15 Apr 2021 18:40:07 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id x69sm3137357pfd.161.2021.04.15.18.40.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Apr 2021 18:40:06 -0700 (PDT) Date: Thu, 15 Apr 2021 18:40:04 -0700 From: Noah Misch To: Tom Lane Cc: Robert Haas , PostgreSQL Hackers , Peter Eisentraut Subject: Re: Converting contrib SQL functions to new style Message-ID: <20210416014004.GA1365702@rfd.leadboat.com> References: <3395418.1618352794@sss.pgh.pa.us> <20210414020827.GA1232417@rfd.leadboat.com> <3441172.1618369873@sss.pgh.pa.us> <20210414125811.GB1263822@rfd.leadboat.com> <3489827.1618411777@sss.pgh.pa.us> <3566011.1618422104@sss.pgh.pa.us> <3567049.1618423436@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3567049.1618423436@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 14, 2021 at 02:03:56PM -0400, Tom Lane wrote: > Robert Haas writes: > > On Wed, Apr 14, 2021 at 1:41 PM Tom Lane wrote: > >> Could we hack things so that extension scripts are only allowed to > >> reference objects created (a) by the system, (b) earlier in the > >> same script, or (c) owned by one of the declared prerequisite > >> extensions? Seems like that might provide a pretty bulletproof > >> defense against trojan-horse objects, though I'm not sure how much > >> of a pain it'd be to implement. Good idea. > > That doesn't seem like a crazy idea, but the previous idea of having > > some magic syntax that means "the schema where extension FOO is" seems > > like it might be easier to implement and more generally useful. > > I think that's definitely useful, but it's not a fix for the > reference-capture problem unless you care to assume that the other > extension's schema is free of trojan-horse objects. I could see using that, perhaps in a non-SQL-language function. I agree it solves different problems.