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 1oqr7N-0004ce-Hr for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 07:27:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oqr7L-0004kU-9s for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 07:27:55 +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 1oqr7K-0004kD-Tk for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 07:27:55 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oqr7G-0007Fg-Ii for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 07:27:54 +0000 Received: by mail-wm1-x333.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso4955068wmb.0 for ; Fri, 04 Nov 2022 00:27:50 -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=VUDgWWa3jdUsaBsBWeppgL1j00e9z69fKWSDQZWzEWQ=; b=ai8XVXxo5yAARHgulC6JrXnQLTf3PslkpR692QGkvrzHKMA/A8ZqO811s3qx3L7GR/ LGSa30b2nbwwlgfVkc50OVtLqLH5aqtSSgPlMId67fazvK2k0XMM5yxztO3/DLjIFS4M tAqViTYPYrlkswnd4bweyoP50SofpRjRCyP/7hzwMo+e3G5xBC8HnIogStIahwKmfLIP rwEsrmgo5JBkgYoV0QcJQfjiNCmY2nVQARUjSgXNNEzUk+AALdMlnWpL6HlWObDM5qbk BUQUnlVo95MfArGRiuEGktcMhAd/75ARNR7ocAvOrQsVuW2Lnx6kzN7V2VsV+jy7o23P 8/2Q== 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=VUDgWWa3jdUsaBsBWeppgL1j00e9z69fKWSDQZWzEWQ=; b=rOU4S/mnCLCK7zT9KbZ/dkZottiwUIuoYXmeagVfvtgam5o9IwvCB/TxeoTDanwomt vjik2uFhKYWkJGza5BQz4STAwWixAkMNjFp6wy23onr5eupmN8Qyj7eenzTn5S0io8Qz m+Md3e7gCjVTs5XjI0DpxKsxW1kNkxkmMvQz9DtishXCk+H1w5D4oDCC83M4JZevdoUB oFlpoAGJ+HY52+4HVbVBiRbLMGn7cIwU8Sbx7an6f7w6SICW7EjR4WoNTZ9qBgZiIap9 lwgDuBtr+Pf/iNeLKvKIF5r0tzC/VZCrnzMOoRIQWsRjuELiTBw6KsfFZy55ph9AHn/n peCg== X-Gm-Message-State: ACrzQf38vlsshU4AdepFVBj1bcLBfrVU3U8CNi2wU0Is44UqQ9SlGWSu f/Qy4/KrJgl7CN6GwBoimwT0Fw== X-Google-Smtp-Source: AMsMyM6c9+nRA5itwWI64iCQP7R8Tvbig63U701+nC/xm30vWEkZjp/BcMKdi0BxZZEkBKeV1H8vpg== X-Received: by 2002:a05:600c:4e47:b0:3c6:fc59:5eff with SMTP id e7-20020a05600c4e4700b003c6fc595effmr32446606wmq.18.1667546868855; Fri, 04 Nov 2022 00:27:48 -0700 (PDT) Received: from antos ([88.103.134.65]) by smtp.gmail.com with ESMTPSA id az24-20020adfe198000000b0022cd0c8c696sm2799531wrb.103.2022.11.04.00.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 00:27:47 -0700 (PDT) From: Antonin Houska To: Peter Eisentraut cc: Euler Taveira , Amit Kapila , PostgreSQL Hackers Subject: Re: Privileges on PUBLICATION In-reply-to: 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> Comments: In-reply-to Peter Eisentraut message dated "Thu, 03 Nov 2022 11:49:51 -0400." 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: <2496.1667546930.1@antos> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Nov 2022 08:28:50 +0100 Message-ID: <2497.1667546930@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut wrote: > On 03.11.22 01:43, Antonin Houska wrote: > > Peter Eisentraut wrote: > > = > >> The CF entry is about privileges on publications. Please rebase that= patch > >> and repost it so that the CF app and the CF bot are up to date. > > The rebased patch (with regression tests added) is attached here. > = > Some preliminary discussion: > = > What is the upgrade strategy? I suppose the options are either that > publications have a default acl that makes them publicly accessible, = > thus preserving the existing behavior by default, or pg_dump would need = to > create additional GRANT statements when upgrading from pre-PG16. I don'= t see > anything like either of these mentioned in the patch. What is your plan= ? So far I considered the first > You might be interested in this patch, which relates to yours: > https://commitfest.postgresql.org/40/3955/ ok, I'll check. > Looking at your patch, I would also like to find a way to refactor away = the > ExecGrant_Publication() function. I'll think about that. > = > I think you should add some tests under src/test/regress/ for the new GR= ANT > and REVOKE statements, just to have some basic coverage that it works. > sql/publication.sql would be appropriate, I think. I thought about the whole concept a bit more and I doubt if the PUBLICATIO= N privilege is the best approach. In particular, the user specified in CREAT= E SUBSCRIPTION ... CONNECTION ... (say "subscription user") needs to have SE= LECT privilege on the tables replicated. So if the DBA excludes some columns fr= om the publication's column list and sets the (publication) privileges in suc= h 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 excl= uded columns. As an alternative to the publication privileges, I think that the CREATE SUBSCRIPTION command could grant ACL_SELECT automatically to the subscript= ion user on the individual columns contained in the publication column list, a= nd DROP SUBSCRIPTION would revoke that privilege. Of course a question is what to do if the replication user already has tha= t privilege on some columns: either the CREATE SUBSCRIPTION command should r= aise ERROR, or we should introduce a new privilege (e.g. ACL_SELECT_PUB) for th= is purpose, which would effectivelly be ACL_SELECT, but hidden from the users= of GRANT / REVOKE. If this approach was taken, the USAGE privilege on schema would need to be granted / revoked in a similar way. What do you think about that? -- = Antonin Houska Web: https://www.cybertec-postgresql.com