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 1mo6VC-0007DJ-Ec for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Nov 2021 16:12:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mo6VB-0007Vp-Br for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Nov 2021 16:12:37 +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 1mo6VA-0007Vg-Ml for pgsql-hackers@lists.postgresql.org; Fri, 19 Nov 2021 16:12:37 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mo6V5-0000ct-V5 for pgsql-hackers@postgresql.org; Fri, 19 Nov 2021 16:12:36 +0000 Received: by mail-pg1-x52c.google.com with SMTP id h63so8998487pgc.12 for ; Fri, 19 Nov 2021 08:12:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hR+8BUu/VZ19MOsIRyOES9OCEnPyrT479lFZ/8vpMYc=; b=MjDTRlPOOfhUdSXZq0TwuK1Kc+tp0XkWWOqmMs4EoBD1VY1vi3Uah9jqYgmQm2JF7N E1pNfpX+mOMXPcbgQAWjlBAanMh3dLOtt7Kf3B1TedvLqUNBsg1Q+xGgi4qT0BHU/FQO r1OS2xLjz9gsj0oL1Ud/zacnH/mV++GAi9AQq4jH34DBSF+XVoxbHbM5H8LOkD6YqE5g wkMvRUowOskboONSzxYZHnLNILG2OKjce02XwzOEDEVDAjrjMp6rlKWigDGG/RxCl8BP xFHy5gKTPuNy6XBzjHA4NWpOof8WMerRTVV5/VPZuxzWW4r3Xhdcx3fS1YdquV1cqyvQ k+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hR+8BUu/VZ19MOsIRyOES9OCEnPyrT479lFZ/8vpMYc=; b=jXBqQg3dxSKkHOP8PJwXByvlaR1bAt0OKmKFsrriy60Yr0oGMU2prKEyqVRjZGv844 rLWlj7PJcVsmmSo1E0pjbTyCXEa8k+scrPL1N37fZVYwfXQTt3R5kY0+NI7bDhYuWhRc qi4FUDEVFVaG8fzOtflwJam0i7DXAic+1n/0sFITEmnDruzMzIhiTU6Lr6frod1Q26Pc QPEXeYOIJzvcwdHAyu+X3O4S92SeTjVQZ5MmmXCB2hfU4Pfe6+1Uv/bVSpjFd5bZ69wB 3fgSAQbrHWv05SQ9pczzpb/FKtgIytuO6FrSbEyD5Sz5cGrC8H2GkjWI1O2h2lbFuS1o 4gEA== X-Gm-Message-State: AOAM533tnOrOLg14ERuAiNPorNg6BSdaTTtuGXZF8J9tNGC6zFvpujcf LP6T/qWFH3liQvtxUqn68URvzbjz7GTL11xL+5WaoL5An4T/UGOHtQbaDNJ8Hw6RgI7koJb//EN +lhQ4iXmnSn7G80ZOzymv810qQNjHkMFEi530u/qGuSN9Mkpu1Vr/lURMcUOQOlQJoB9u8ouKrZ xs8BfprGIWJmnGu7pOZuVgauoRjn6W+IUoBsxd X-Google-Smtp-Source: ABdhPJz/liGKd+iDEEO7kAjE1cr4rjJflyPFa1evB7fWldleo6qOyoBfasx0iamINB5FH+b95JDqVQ== X-Received: by 2002:a63:9d09:: with SMTP id i9mr18073226pgd.8.1637338349328; Fri, 19 Nov 2021 08:12:29 -0800 (PST) Received: from laptop280-ma-us.hitronhub.home (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id p3sm134892pjd.45.2021.11.19.08.12.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Nov 2021 08:12:28 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Non-superuser subscription owners From: Mark Dilger In-Reply-To: Date: Fri, 19 Nov 2021 08:12:27 -0800 Cc: Jeff Davis , Andrew Dunstan , PostgreSQL-development , Robert Haas Content-Transfer-Encoding: quoted-printable Message-Id: <22738092-BF0E-4C70-977B-D51EE43BBCD8@enterprisedb.com> References: <9DFC88D3-1300-4DE8-ACBC-4CEF84399A53@enterprisedb.com> <6BB4451E-7B1B-474C-BD1F-DB7531E720C6@enterprisedb.com> <6A2B0FF6-CC86-48CE-B0D3-5401AA5CFEA9@enterprisedb.com> <0774acfb4e613b9959c4e4995ba163cdadc454ef.camel@j-davis.com> <2EA8302B-9805-4FAA-A95D-C4D5CEB82916@enterprisedb.com> <47f0d0e528451041c04d61c7dcf18ad01174d2db.camel@j-davis.com> To: Amit Kapila X-Mailer: Apple Mail (2.3608.120.23.2.7) X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Nov 19, 2021, at 2:23 AM, Amit Kapila = wrote: >=20 > I was thinking why not separate the ownership and "run as" privileges > for the subscriptions? We can introduce a new syntax in addition to > the current syntax for "Owner" for this as: >=20 > Create Subscription sub RUNAS ...; > Alter Subscription sub RUNAS >=20 > Now, RUNAS role will be used to apply changes and perform the initial > table sync. The owner will be tied to changing some of the other > properties (enabling, disabling, etc.) of the subscription. Now, we > still need a superuser to create subscription and change properties > like CONNECTION for a subscription but we can solve that by having > roles specific to it as being indicated by Mark in some of his > previous emails. I feel disquieted about the "runas" idea. I can't really say why yet. = Maybe it is ok, but it feels like a larger design decision than just an = implementation detail about how subscriptions work. We should consider = if we won't soon be doing the same thing for other parts of the system. = If so, we should choose a solution that makes sense when applied more = broadly. Security definer functions could benefit from splitting the owner from = the runas role. Event triggers might benefit from having a runas role. Currently, event = triggers are always owned by superusers, but we've discussed allowing = non-superuser owners. That proposal still has outstanding issues to be = resolved, so I can't be sure if runas would be helpful, but it might. Table triggers might benefit from having a runas role. I don't have a = proposal here, just an intuition that we should think about this before = designing how "runas" works. =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company