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 1pGVMJ-000177-2a for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Jan 2023 01:29:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pGVMI-0007ac-0j for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Jan 2023 01:29:22 +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 1pGVMH-0007a5-O0 for pgsql-hackers@lists.postgresql.org; Sat, 14 Jan 2023 01:29:21 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pGVMF-0002tT-7V for pgsql-hackers@postgresql.org; Sat, 14 Jan 2023 01:29:20 +0000 Received: by mail-ed1-x52d.google.com with SMTP id s6so1227847edd.13 for ; Fri, 13 Jan 2023 17:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+TWjeP7/KxWqPvi7hz55T/UsPN2pBvTCKlvOdCe7+Q8=; b=joAT7KpAbT7Q1Eu62ylVj29ALzkhAWub4wuZEsV8ypB3hBW7rJmN5NzDaLevm09z4B AnmJbjPnHwRGJepR5TuIzFoGHSyBXOg7fzLeRTFGpH5OeW+/Tce+8kGwx0NmC1YoAVxz 5rGsCeacPyDNh4h6/SnSHvBOAdOpHB2R5fSdAGi4mxY6UiOlUM9W8ZTjXDQ1lMoTy/0u hd95grpfCneuy9r6QP9yP1jnfiXZ+4JgUsk8ymYxeHbIIGswztAGy8jVNIuqHgLLFPS2 qjtTV7gib3Ui53Ii483vECT5xWs9VMosDzUR3zm6sPwJigSzSLae1KlRoBIVlTJWPEZt Ky/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+TWjeP7/KxWqPvi7hz55T/UsPN2pBvTCKlvOdCe7+Q8=; b=I/38UezS45QARlBggmiTsG/3EGIHMrkNqCfXEXkeGhaIA+s1BnAQRI+FzaJwoyg6Zf uG/kyDIwrGSYin2/l8It1mocSYPARjO/pjRUpXVu9tHEiNOFWdGLbsFBEHYPo9OZXuid /uhK/3ReovD2VTz3vsPbRUFN6C7OBj99bJC+q5oL/5muElZHuWQ8MsHALgjfkNCYAhjx g4a/u9PsH1GukZ3mkv3F9bUrP1gvYNSPwjER5ugguCsijpzC+4XsgJXibrWHyykutrnJ lQS0ms50tuBcrzRMSkuIC1rOg+XAV9d8pvztuVmPPEF1VaRTc0e/vHIe3su4qdu77eqe sijA== X-Gm-Message-State: AFqh2krE8x588lUgBYQex8XjItfrBeBeNL2X0Ia3+lB/t0X/K92DAnQQ UMynpPZ0FmUvvITl092XBHrPaQA/EPzdbfcI6Hk= X-Google-Smtp-Source: AMrXdXveNeJdqI6+iBncnVlyTV/1lVQfjwKXnfQcqrRs2tTeeiatsqR2efor3bWLRG+UG9A4N5Vb37vLOEwdLkpGHcA= X-Received: by 2002:a05:6402:22f2:b0:496:e060:44ff with SMTP id dn18-20020a05640222f200b00496e06044ffmr3054828edb.226.1673659757055; Fri, 13 Jan 2023 17:29:17 -0800 (PST) MIME-Version: 1.0 References: <404209.1673404807@sss.pgh.pa.us> <408089.1673407504@sss.pgh.pa.us> <668179.1673470826@sss.pgh.pa.us> <20230113234635.kyelgvnnak6jxzlx@awork3.anarazel.de> In-Reply-To: <20230113234635.kyelgvnnak6jxzlx@awork3.anarazel.de> From: "David G. Johnston" Date: Fri, 13 Jan 2023 18:29:00 -0700 Message-ID: Subject: Re: pgsql: Add new GUC createrole_self_grant. To: Andres Freund Cc: Robert Haas , Tom Lane , "pgsql-hackers@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000004b510305f22f472a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004b510305f22f472a Content-Type: text/plain; charset="UTF-8" On Fri, Jan 13, 2023 at 4:46 PM Andres Freund wrote: > > I don't really see what that has to do with the topic at hand, unless you > want > to suggest removing the entire section about how to write secure security > definer functions? > Not remove, but I'm not seeing why the introduction of this GUC requires any change to the documentation. I'll leave discussion of security invoker to the other thread going on right now. > The point of the security definer section is to explain how to safely write > security definer functions that you grant to less privileged users > Yeah, we are really good at "how". + If the security definer function intends to create roles, and if it + is running as a non-superuser, createrole_self_grant + should also be set to a known value using the SET + clause. I'd like to know "why". Without knowing why we are adding this I can't give it a +1. I want the patch to include the why. David J. --0000000000004b510305f22f472a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Jan 13, 2023 at 4:46 PM Andres Freund <andres@anarazel.de> wrote:
=

I don't really see what that has to do with the topic at hand, unless y= ou want
to suggest removing the entire section about how to write secure security definer functions?

Not remove, but I= 'm not seeing why the introduction of this GUC requires any change to t= he documentation.

I'll leave discussion of s= ecurity invoker to the other thread going on right now.

<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
The point of the security definer section is to explain how to safely write=
security definer functions that you grant to less privileged users

Yeah, we are really good at "how".=

+ =C2=A0 =C2=A0If the security definer function inten= ds to create roles, and if it
+ =C2=A0 =C2=A0is running as a non-superus= er, <varname>createrole_self_grant</varname>
+ =C2=A0 =C2=A0= should also be set to a known value using the <literal>SET</litera= l>
+ =C2=A0 =C2=A0clause.

I'd like to kn= ow "why".=C2=A0 Without knowing why we are adding=C2=A0this I can= 't give it a=C2=A0+1.=C2=A0 I want the patch to include the why.
<= div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif= ">
David J.

--0000000000004b510305f22f472a--