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 1mycwT-0002BN-07 for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Dec 2021 16:52:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mycwP-00085c-UA for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Dec 2021 16:52:13 +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 1mycwO-00085T-QU for pgsql-hackers@lists.postgresql.org; Sat, 18 Dec 2021 16:52:13 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mycwG-0008QC-2n for pgsql-hackers@postgresql.org; Sat, 18 Dec 2021 16:52:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 874285C00EC; Sat, 18 Dec 2021 11:52:00 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 18 Dec 2021 11:52:00 -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=wWK6IwalfflZI//TBbLhwDGKI9yY68ZJypfcGtndjL4=; b=j0NPod85 IFFt3n7X01pw98tcq/ta/Ti6ESC9YMdjxpCpXvQMCHRCOfwo4pflRLFkcIKnG/c7 Av/SK0gVHm5lnnyMEzcphYK510eNRwtYB0nsnV7dbrpnFK7VlqVFTpeUDakf+XvJ i73pUGGqyrsGqIvMzFSMHGDM2h8NhQ8RVLx6LVtRyyVTzbndQflRQAFhFfuNROt9 iAhFg8mgVsEz/RXk6TatbT39cCkjL0Dr1+CYyN7Doyf8xe2V3xD0kSGoZcY+crkT LWieXW1oOeFUa7n0nXiqRy66FsW0V7b61+coVt9FYdjXtnjlnBtTO1u5DVKm3ZJq h/BG6X3oidUd+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleekgdelfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Dec 2021 11:51:59 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id B902F2A07D0; Sat, 18 Dec 2021 13:51:56 -0300 (-03) Date: Sat, 18 Dec 2021 13:51:56 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: Rahila Syed , PostgreSQL-development Subject: Re: Column Filtering in Logical Replication Message-ID: <202112181651.rvbel4vj5bli@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <670fbd5b-5fc3-8c30-a7bf-ad1d6ea2d4a5@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Dec-18, Tomas Vondra wrote: > On 12/18/21 02:34, Alvaro Herrera wrote: > > On 2021-Dec-17, Tomas Vondra wrote: > > > > 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. > > > > > > Right. Although I haven't thought about how logical decoding > > > interacts with column privileges. I don't think logical decoding > > > actually checks column privileges - I certainly don't recall any > > > ACL checks in src/backend/replication ... > > > > Well, in practice if you're confronted with a replica that's > > controlled by a malicious user that can tweak its behavior, then > > replica-side privilege checking won't do anything useful. > > I don't follow. Surely the decoding happens on the primary node, > right? Which is where the ACL checks would happen, using the role the > replication connection is opened with. I think you do follow. Yes, the decoding happens on the primary node, and the security checks should occur in the primary node, because to do otherwise is folly(*). Which means that column filtering, being a replica-side feature, is *not* a security feature. I was mistaken about it, is all. If you want security, you need to use column-level privileges, as you say. (*) The checks *must* occur in the primary side, because the primary does not control the code that runs in the replica side. The primary must treat the replica as running potentially hostile code. Trying to defend against that is not practical. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/