Re: Why does creating logical replication subscriptions require superuser? - Mailing list pgsql-hackers

From Thomas Kellerer
Subject Re: Why does creating logical replication subscriptions require superuser?
Date
Msg-id cc881a1f-a416-5315-8581-173304e1d5ce@gmx.net
Whole thread Raw
In response to Re: Why does creating logical replication subscriptions require superuser?  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: Why does creating logical replication subscriptions require superuser?  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
Andrey Borodin schrieb am 22.01.2021 um 08:32:

> Replication is running under superuser and e.g. one can add system catalog to subscription.
> Or exploit this fact other way. Having superuser you can just COPY FROM PROGRAM anything.

It was my understanding that the replication process itself runs with the user specified
when creating the subscription - which is no necessarily a superuser. Only a user that
is part of the "replication" role.

The replication user also needs to be granted SELECT privileges on all tables of the publication,
so it's quite easy to control what the replication user has access to.
Plus the publication also limits what the replication can see.

I second the idea that not requiring a superuser to create a subscription would make things
a lot easier. We worked around that by creating a security definer function that runs
the CREATE SUBSCRIPTION command.

Thomas



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Preventing hangups in bgworker start/stop during DB shutdown
Next
From: Greg Nancarrow
Date:
Subject: Re: Parallel INSERT (INTO ... SELECT ...)