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 1npOuW-0006TZ-Vd for pgsql-hackers@arkaria.postgresql.org; Fri, 13 May 2022 06:36:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1npOuV-00063A-KO for pgsql-hackers@arkaria.postgresql.org; Fri, 13 May 2022 06:36:23 +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 1npOuV-000631-BT for pgsql-hackers@lists.postgresql.org; Fri, 13 May 2022 06:36:23 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1npOuO-0004Wa-79 for pgsql-hackers@lists.postgresql.org; Fri, 13 May 2022 06:36:22 +0000 Received: by mail-ed1-x52c.google.com with SMTP id k27so8792329edk.4 for ; Thu, 12 May 2022 23:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:comments:mime-version :date:message-id; bh=yhiEvLTn5LeH3RysG5vXf6mJ6wAot9xho51S5kAkAT8=; b=SVDMmBQOsUlywUB8cR1Yep1XNN5uPbhcrONDhH2Gp7LO7qg29BiDcYrJQV35d+vS9z OLsXGm6duX7gWuzKkFG3e/jdLs+GT8dgWbqFxNB37l8dg67qLusY7W/0YUCgtDBWks24 9qrlB9ubc1Xi+OgQhaH11xUnhJDgopFlXTc0AXrdV1IyWlPWi7NYwg0JhmXiXf1RN7eK +cIIk1CcQXmATzteplxkw0WxRwQZToqRJTY1tFEaikPvGvr+B/Xw9QjugxXLc0T0Wlrs AcbYHrjyFY84mHUDV5p5hu6Z8NASe+OZpp7druYk38WnvEgW4mzAaulfzjHgiLKhrWgK Tgpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :comments:mime-version:date:message-id; bh=yhiEvLTn5LeH3RysG5vXf6mJ6wAot9xho51S5kAkAT8=; b=oRMiEgoqvbmazCZmMErdFSCK/I6Bzm33SMs0U8UeDxx6ITTi7cyJAYieWPBIr5Y+Y+ 3tXKAmSzho20n/ec59HCFL7FRmoM97ny7jpYrvbMkUM6k4vYOMzKH8VA+4biUSx+e6n5 j+TVemwQmOT0DCebaKF09l8H0elOKIwWXyyVbhU2cR6v7UxpCBrJAaOWATIzkemE2yTk 2tOt6xfGR73gP1IKGbNuUbOOWSDKozLPAOFt7O7MsrSVlPJi3zf5iyIXhpMSs2L1sdyK bBcSw+HKc8x++TJowh/PKsvLHueUk2ec8xiOjjbeDNFYgP/GaIQyoGA5IMLhM6dSNKsn jQSg== X-Gm-Message-State: AOAM532jK0LLdjG4bHafQBxyDnY03G68p5zAFuQ2BizEPOm8HR6rOYuL VJkoVHvFXVkoVDc9OvjgxmdPnw== X-Google-Smtp-Source: ABdhPJxC++kmVEkjZPvoAaNJu12sHzaR6at8XHt9vIuj9gMng2QunRSzrVpqEaJrvCY2PsxF4XWJdA== X-Received: by 2002:a05:6402:1007:b0:428:beb6:f483 with SMTP id c7-20020a056402100700b00428beb6f483mr15175775edu.391.1652423774905; Thu, 12 May 2022 23:36:14 -0700 (PDT) Received: from antos (85-207-121-76.static.bluetone.cz. [85.207.121.76]) by smtp.gmail.com with ESMTPSA id 10-20020a17090601ca00b006f3ef214e38sm429121ejj.158.2022.05.12.23.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:36:14 -0700 (PDT) From: Antonin Houska To: "Euler Taveira" cc: "Amit Kapila" , "Peter Eisentraut" , "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> Comments: In-reply-to "Euler Taveira" message dated "Thu, 12 May 2022 09:48:28 -0300." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 27.2.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Fri, 13 May 2022 08:36:37 +0200 Message-ID: <5859.1652423797@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Euler Taveira wrote: > On Tue, May 10, 2022, at 5:37 AM, Antonin Houska wrote: > > My understanding is that the rows/columns filtering is a way for the > *publisher* to control which data is available to particular replica. From > this point of view, the publication privileges would just make the control > complete. > > I agree. IMO it is a new feature. We already require high privilege for logical > replication. Hence, we expect the replication user to have access to all data. > Unfortunately, nobody mentioned about this requirement during the row filter / > column list development; someone could have written a patch for GRANT ... ON > PUBLICATION. I can try that for PG 16, unless someone is already working on it. > I understand your concern. Like I said in my last sentence in the previous > email: it is a fine-grained access control on the publisher. Keep in mind that > it will *only* work for non-superusers (REPLICATION attribute). It is not > exposing something that we didn't expose before. In this particular case, there > is no mechanism to prevent the subscriber to obtain data provided by the > various row filters if they know the publication names. We could probably add a > sentence to "Logical Replication > Security" section: > > There is no privileges for publications. If you have multiple publications in a > database, a subscription can use all publications available. Attached is my proposal. It tries to be more specific and does not mention the absence of the privileges explicitly. -- Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=publication_filtering_warning.diff diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index 1a828e8d2ff..b74ba625649 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -94,6 +94,16 @@ CREATE PUBLICATION name list is specified, it must include the replica identity columns. + + + If you are using the WHERE clause or the column list + to omit some table data from the replication for security reasons, + please make sure that the same data is not exposed via other + publications which contain the same table and have different (or + none) WHERE clause or column list. + + + Only persistent base tables and partitioned tables can be part of a publication. Temporary tables, unlogged tables, foreign tables, --=-=-=--