Skip to content

Commit 3590680

Browse files
committed
Fix incorrect permissions on pg_subscription.
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/[email protected]
1 parent 187682c commit 3590680

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/backend/catalog/system_views.sql

+3-2
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,8 @@ CREATE VIEW pg_replication_origin_status AS
12521252

12531253
REVOKE ALL ON pg_replication_origin_status FROM public;
12541254

1255-
-- All columns of pg_subscription except subconninfo are readable.
1255+
-- All columns of pg_subscription except subconninfo are publicly readable.
12561256
REVOKE ALL ON pg_subscription FROM public;
1257-
GRANT SELECT (subdbid, subname, subowner, subenabled, subbinary, substream, subslotname, subpublications)
1257+
GRANT SELECT (oid, subdbid, subname, subowner, subenabled, subbinary,
1258+
substream, subslotname, subsynccommit, subpublications)
12581259
ON pg_subscription TO public;

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 202105272
56+
#define CATALOG_VERSION_NO 202106031
5757

5858
#endif

src/include/catalog/pg_subscription.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
* them to be able to start the workers, so we have to put them in a shared,
3535
* nailed catalog.
3636
*
37-
* NOTE: When adding a column, also update system_views.sql.
37+
* CAUTION: There is a GRANT in system_views.sql to grant public select
38+
* access on all columns except subconninfo. When you add a new column
39+
* here, be sure to update that (or, if the new column is not to be publicly
40+
* readable, update associated comments and catalogs.sgml instead).
3841
*/
3942
CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO
4043
{

0 commit comments

Comments
 (0)