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 1or0cM-0004fE-2k for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 17:36:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1or0cK-00018E-W1 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 17:36:32 +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 1or0cK-000185-HJ for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 17:36:32 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1or0cH-0004rQ-Up for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 17:36:32 +0000 Received: by mail-wm1-x329.google.com with SMTP id i5-20020a1c3b05000000b003cf47dcd316so5848567wma.4 for ; Fri, 04 Nov 2022 10:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=o7tEr+2lQxwJDXxVhsN7qrGJ+F0fkmzbdTVh64ahl24=; b=uvobVvBSJDaLGnKJSeuY7RibSRkI1OJYHhggo9NpdVzXdyecW+X8SO7UmgZsjt/zME zEX5n6aBZcfXrf4B8wOLr6Wl/nFkDg5KBNfxX3YaNS8DBFcUOiaOygXSjMumuBHzGwhx bBDGCxlVlYArNMG1HHY05yUOjyW0EQL/WXvvD8inHlOf+vfP++9JtAgbHa1aHvfDCgMr KAhEJe2AHIeyCt7fIjnpOyEApNOffrfse36gDRyOJxWea5xmBdE6HzURQY/rIclQVy7O YiKzbo37AKVOm1DOnW9DhD58K5dGvwL5LVM1SukiBvHLku14l23ANlz8Q4sgU2PXcSpk 6W7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o7tEr+2lQxwJDXxVhsN7qrGJ+F0fkmzbdTVh64ahl24=; b=wuaxpIj2ugBDrTHhnU3Sv9I2ic7AslixvO2t1oTM76fdCLLvLe0y3fVeuv5ORBT+6v rdOI6NBJxSEPC7VxY7MPKQzvpz0OQmITDtjevLf/CcOHK+juy2BEUdkRxpimQs1dGbja dhKRSyohi4sSfqQRKOAywUvg9HKWLJGo8FMhN1ly+jeovZaLsfiyIfso3j/uLFC1TkKo RLRW3kIx28gpPrZ357++Mh9xcypjxsxk7ff+sujHmjwaC6P/YuJM6s2N35gHSuJRugN+ OSQbfXqX3JPb4tkTI41NSqq4puaJHagihrPq3/Jl9kmckFO93euiwFJcGVetVxNFI7mB 0vKw== X-Gm-Message-State: ACrzQf0JA/MRg200QBDjEDqmTmFhBinofWP13SPNJnftfxzGU0vvjN+b LQPNwwdAUuLvPdZUm212m5aUWg== X-Google-Smtp-Source: AMsMyM5Fn/7Y21JrX5ESk5DTztPAmy4jnDSKgnNvg00CVdJk9aoTrOntNrHF3Rm+mT+cQtHPcclvPw== X-Received: by 2002:a05:600c:4e8b:b0:3cf:5d41:bf14 with SMTP id f11-20020a05600c4e8b00b003cf5d41bf14mr25107398wmq.117.1667583388754; Fri, 04 Nov 2022 10:36:28 -0700 (PDT) Received: from antos ([88.103.134.65]) by smtp.gmail.com with ESMTPSA id n17-20020a05600c4f9100b003c701c12a17sm3761811wmq.12.2022.11.04.10.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 10:36:28 -0700 (PDT) From: Antonin Houska To: Mark Dilger cc: Peter Eisentraut , Euler Taveira , Amit Kapila , PostgreSQL Hackers Subject: Re: Privileges on PUBLICATION In-reply-to: <30297BD0-7EBA-48AB-885C-2B5BAAE7619B@enterprisedb.com> References: <20330.1652105397@antos> <8a00e0e1-dc4e-422c-9dcf-664b16b18625@www.fastmail.com> <2810.1652171844@antos> <5859.1652423797@antos> <57022.1652867097@antos> <4c420c17-8570-4b52-b7f6-9ce3f53d7ef9@www.fastmail.com> <14292.1655733695@antos.home> <746c9a65-e2cc-2573-a50e-ab5ea884f680@enterprisedb.com> <1537.1667454192@antos> <2497.1667546930@antos> <30297BD0-7EBA-48AB-885C-2B5BAAE7619B@enterprisedb.com> Comments: In-reply-to Mark Dilger message dated "Fri, 04 Nov 2022 10:17:17 -0700." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 27.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <89891.1667583451.1@antos> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Nov 2022 18:37:31 +0100 Message-ID: <89892.1667583451@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mark Dilger wrote: > > On Nov 4, 2022, at 12:28 AM, Antonin Houska wrote: > > = > > I thought about the whole concept a bit more and I doubt if the PUBLIC= ATION > > privilege is the best approach. In particular, the user specified in C= REATE > > SUBSCRIPTION ... CONNECTION ... (say "subscription user") needs to hav= e SELECT > > privilege on the tables replicated. So if the DBA excludes some column= s from > > the publication's column list and sets the (publication) privileges in= such a > > way that the user cannot get the column values via other publications,= the > > user still can connect to the database directly and get values of the = excluded > > columns. > > = > > As an alternative to the publication privileges, I think that the CREA= TE > > SUBSCRIPTION command could grant ACL_SELECT automatically to the subsc= ription > > user on the individual columns contained in the publication column lis= t, and > > DROP SUBSCRIPTION would revoke that privilege. > > = > > Of course a question is what to do if the replication user already has= that > > privilege on some columns: either the CREATE SUBSCRIPTION command shou= ld raise > > ERROR, or we should introduce a new privilege (e.g. ACL_SELECT_PUB) fo= r this > > purpose, which would effectivelly be ACL_SELECT, but hidden from the u= sers of > > GRANT / REVOKE. > > = > > If this approach was taken, the USAGE privilege on schema would need t= o be > > granted / revoked in a similar way. > = > When you talk about a user needing to have privileges, it sounds like yo= u > mean privileges on the publishing database. But then you talk about CRE= ATE > SUBSCRIPTION granting privileges, which would necessarily be on the > subscriber database. Can you clarify what you have in mind? Right, the privileges need to be added on the publishing side, but the use= r that needs those privileges is specified on the subscription side. I didn'= t think much in detail how it would work. The "subscription user" certainly cannot connect to the publisher database and add grant the privileges to itself. Perhaps some of the workers on the publisher side could do it on startup. -- = Antonin Houska Web: https://www.cybertec-postgresql.com