Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server - Mailing list pgsql-hackers

From Shlok Kyal
Subject Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server
Date
Msg-id CANhcyEU9VsaLwo908ws_1MxNB79f+cr-JVfig=Zoaf4+KQe+GQ@mail.gmail.com
Whole thread
In response to Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
Hi,

While testing another patch, I found a bug related to subscriptions
created using a foreign server.

Suppose a subscription is created using a foreign server, and the
subscription owner does not have permission to access that server. If
the owner executes ALTER SUBSCRIPTION ... REFRESH PUBLICATION, ADD
PUBLICATION, DROP PUBLICATION, or SET PUBLICATION, the command
can still connect to the publisher and fetch the updated relation
list.

This happens because AlterSubscription() calls:
GetSubscription(subid, false, orig_conninfo_needed, false)
with conninfo_aclcheck set to false, so the ACL check on the
associated foreign server is skipped.

The attached patch fixes this by enabling conninfo_aclcheck for
these ALTER SUBSCRIPTION operations, ensuring that permissions on
the foreign server are validated before connecting to the publisher.
Thoughts?

I am posting the patch in this thread since the related changes were made here.

Thanks,
Shlok Kyal

Attachment

pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: [PATCH] Add tests for src/backend/nodes/extensible.c
Next
From: Tender Wang
Date:
Subject: Re: remove_useless_joins vs. bug #19560