pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Respect permissions within logical replication.
Date: Sat, 08 Jan 2022 02:40:56 +0000
Message-ID: <E1n61f6-0006DS-Ek@gemulon.postgresql.org> (raw)

Respect permissions within logical replication.

Prevent logical replication workers from performing insert, update,
delete, truncate, or copy commands on tables unless the subscription
owner has permission to do so.

Prevent subscription owners from circumventing row-level security by
forbidding replication into tables with row-level security policies
which the subscription owner is subject to, without regard to whether
the policy would ordinarily allow the INSERT, UPDATE, DELETE or
TRUNCATE which is being replicated.  This seems sufficient for now, as
superusers, roles with bypassrls, and target table owners should still
be able to replicate despite RLS policies.  We can revisit the
question of applying row-level security policies on a per-row basis if
this restriction proves too severe in practice.

Author: Mark Dilger
Reviewed-by: Jeff Davis, Andrew Dunstan, Ronan Dunklau
Discussion: https://postgr.es/m/9DFC88D3-1300-4DE8-ACBC-4CEF84399A53%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a2ab9c06ea15fbcb2bfde570986a06b37f52bcca

Modified Files
--------------
doc/src/sgml/logical-replication.sgml       |  36 ++-
src/backend/commands/subscriptioncmds.c     |   2 +
src/backend/replication/logical/tablesync.c |  28 +++
src/backend/replication/logical/worker.c    |  42 ++++
src/test/perl/PostgreSQL/Test/Cluster.pm    |  36 +++
src/test/subscription/t/027_nosuperuser.pl  | 363 ++++++++++++++++++++++++++++
6 files changed, 499 insertions(+), 8 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1n61f6-0006DS-Ek@gemulon.postgresql.org>
Permalink:  ../E1n61f6-0006DS-Ek@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1n61f6-0006DS-Ek@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: Respect permissions within logical replication.
  In-Reply-To: <E1n61f6-0006DS-Ek@gemulon.postgresql.org>
  References: <E1n61f6-0006DS-Ek@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox