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 1mzJ6z-0000fT-ES for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 13:53: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 1mzJ6y-0001Ig-A7 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 13:53:56 +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 1mzJ6y-0001IX-0L for pgsql-hackers@lists.postgresql.org; Mon, 20 Dec 2021 13:53:56 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzJ6u-0002xb-8H for pgsql-hackers@postgresql.org; Mon, 20 Dec 2021 13:53:54 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 052525C0152; Mon, 20 Dec 2021 08:53:51 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 20 Dec 2021 08:53:51 -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:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=G1rVxY0QRWA3at+J0BvGWC6fHGuGdmnBunefRmzcc 84=; b=ibrxrdjGJyu4kCyqpe8OwD7g/PCeRqHK02qWRPy3ofTRnqHX1IgIzgQrU mQ5WIeSKk/3VneBcWsQmwyTiLGXSHUcFp70GPWOTYTLCBbUipOfAQkQqaiw8wN/8 TRXYI01bfSpFt0zwL6SPRAiuxNB3j4mTqnY3479vokq9NAsrp5bW7oKFsXBWBHLU HwpT2jyfpjWWGTjUL01IWWufG95DHgHE0maIqg3U7WicYoC1QEQf+S6bICEvNLXh 4GIde2h7QyEGXkUw68hin+dpe9aF2DVKeUHRHUhi8C9X2BPb/NOnJTY1JzfzixVi 2R3IIBp0G+pn5feoa+bJEf5VC9gjA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddruddtvddgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeejgeehteeuhfevvedu leeufedtjeetiefftedvudfhtdeifefgueettdevgefgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Dec 2021 08:53:49 -0500 (EST) Message-ID: Date: Mon, 20 Dec 2021 14:53:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: Column Filtering in Logical Replication Content-Language: en-US To: Alvaro Herrera , Rahila Syed Cc: PostgreSQL-development References: <202112172107.i5ebyfyrifk7@alvherre.pgsql> From: Peter Eisentraut In-Reply-To: <202112172107.i5ebyfyrifk7@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 17.12.21 22:07, Alvaro Herrera wrote: > 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. During normal replication, the publisher should only send the columns that are configured to be part of the publication. So I don't see a problem there. During the initial table sync, the subscriber indeed can construct any COPY command. We could maybe replace this with a more customized COPY command variant, like COPY table OF publication TO STDOUT. But right now the subscriber is sort of assumed to have access to everything on the publisher anyway, so I doubt that this is the only problem. But it's worth considering.