Skip to content

Commit

Permalink
Fix incorrect permissions on pg_subscription.
Browse files Browse the repository at this point in the history
The documented intent is for all columns except subconninfo to be
publicly readable.  However, this has been overlooked twice.
subsynccommit has never been readable since it was introduced,
nor has the oid column (which is important for joining).

Given the lack of previous complaints, it's not clear that it's
worth doing anything about this in the back branches.  But there's
still time to fix it inexpensively for v14.

Per report from Israel Barth (via Euler Taveira).

Patch by Euler Taveira, possibly-vain comment updates by me.

Discussion: https://postgr.es/m/b8f7c17c-0041-46b6-acfe-2d1f5a985ab4@www.fastmail.com
  • Loading branch information
tglsfdc committed Jun 3, 2021
1 parent 187682c commit 3590680
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/backend/catalog/system_views.sql
Expand Up @@ -1252,7 +1252,8 @@ CREATE VIEW pg_replication_origin_status AS

REVOKE ALL ON pg_replication_origin_status FROM public;

-- All columns of pg_subscription except subconninfo are readable.
-- All columns of pg_subscription except subconninfo are publicly readable.
REVOKE ALL ON pg_subscription FROM public;
GRANT SELECT (subdbid, subname, subowner, subenabled, subbinary, substream, subslotname, subpublications)
GRANT SELECT (oid, subdbid, subname, subowner, subenabled, subbinary,
substream, subslotname, subsynccommit, subpublications)
ON pg_subscription TO public;
2 changes: 1 addition & 1 deletion src/include/catalog/catversion.h
Expand Up @@ -53,6 +53,6 @@
*/

/* yyyymmddN */
#define CATALOG_VERSION_NO 202105272
#define CATALOG_VERSION_NO 202106031

#endif
5 changes: 4 additions & 1 deletion src/include/catalog/pg_subscription.h
Expand Up @@ -34,7 +34,10 @@
* them to be able to start the workers, so we have to put them in a shared,
* nailed catalog.
*
* NOTE: When adding a column, also update system_views.sql.
* CAUTION: There is a GRANT in system_views.sql to grant public select
* access on all columns except subconninfo. When you add a new column
* here, be sure to update that (or, if the new column is not to be publicly
* readable, update associated comments and catalogs.sgml instead).
*/
CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{
Expand Down

0 comments on commit 3590680

Please sign in to comment.