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 1myKRr-0002Bk-U5 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Dec 2021 21:07:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1myKRq-0006WI-PM for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Dec 2021 21:07:26 +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 1myKRq-0006W9-G8 for pgsql-hackers@lists.postgresql.org; Fri, 17 Dec 2021 21:07:26 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1myKRo-0002QQ-04 for pgsql-hackers@postgresql.org; Fri, 17 Dec 2021 21:07:25 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E2E1F3201C6A; Fri, 17 Dec 2021 16:07:21 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 17 Dec 2021 16:07:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=gQ/CPl8IYAHvjwtsQGUUdWeOhhhS1SK2xSfImLR64yY=; b=Btc4Z1Ng 7KN3x9I2EWsmwsIB2+fVd7sdbq0pR6waH04b22OHqAyaLAR1eT4+lFJMkT0AQ92r 8EAFS+GmcZl4OISrK3w5tex92ZKeXdO0s9DvjtMLDQabOVucWlgVHyUBOWJHoKlQ YZQxX+nU0M/u3KuuPz2qXPF6LorKrb8DmaaWUfbZYd8682CmVRAC+wgu+lVuWE0F mYv6Y2j7khH28HTaFxLXcOHO6/NtBo09D+4DzFLJ2i9zxMS9plFsuFxKSSz0xLAo 45U9MZ3xr9JCTafue0S6qsVdRtmuxj19zSL8Qtrij289xbS7KD74YqXa5IkJIcIi Ec2rEz3vbCgcPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigddugeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 16:07:21 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 3A4E92A07D0; Fri, 17 Dec 2021 18:07:18 -0300 (-03) Date: Fri, 17 Dec 2021 18:07:18 -0300 From: Alvaro Herrera To: Rahila Syed Cc: PostgreSQL-development Subject: Re: Column Filtering in Logical Replication Message-ID: <202112172107.i5ebyfyrifk7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk So I've been thinking about this as a "security" item (you can see my comments to that effect sprinkled all over this thread), in the sense that if a publication "hides" some column, then the replica just won't get access to it. But in reality that's mistaken: the filtering that this patch implements is done based on the queries that *the replica* executes at its own volition; if the replica decides to ignore the list of columns, it'll be able to get all columns. All it takes is an uncooperative replica in order for the lot of data to be exposed anyway. If the server has a *separate* security mechanism to hide the columns (per-column privs), it is that feature that will protect the data, not the logical-replication-feature to filter out columns. This led me to realize that the replica-side code in tablesync.c is totally oblivious to what's the publication through which a table is being received from in the replica. So we're not aware of a replica being exposed only a subset of columns through some specific publication; and a lot more hacking is needed than this patch does, in order to be aware of which publications are being used. I'm going to have a deeper look at this whole thing. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/