Commit 508bf95b authored by Peter Eisentraut's avatar Peter Eisentraut

Remove any-user DML capability from allow_system_table_mods

Previously, allow_system_table_mods allowed a non-superuser to do DML
on a system table without further permission checks.  This has been
removed, as it was quite inconsistent with the rest of the meaning of
this setting.  (Since allow_system_table_mods was previously only
accessible with a server restart, it is unlikely that anyone was using
this possibility.)
Reviewed-by: default avatarTom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com
parent d4feadec
...@@ -3851,7 +3851,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid, ...@@ -3851,7 +3851,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid,
/* /*
* Deny anyone permission to update a system catalog unless * Deny anyone permission to update a system catalog unless
* pg_authid.rolsuper is set. Also allow it if allowSystemTableMods. * pg_authid.rolsuper is set.
* *
* As of 7.4 we have some updatable system views; those shouldn't be * As of 7.4 we have some updatable system views; those shouldn't be
* protected in this way. Assume the view rules can take care of * protected in this way. Assume the view rules can take care of
...@@ -3860,8 +3860,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid, ...@@ -3860,8 +3860,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid,
if ((mask & (ACL_INSERT | ACL_UPDATE | ACL_DELETE | ACL_TRUNCATE | ACL_USAGE)) && if ((mask & (ACL_INSERT | ACL_UPDATE | ACL_DELETE | ACL_TRUNCATE | ACL_USAGE)) &&
IsSystemClass(table_oid, classForm) && IsSystemClass(table_oid, classForm) &&
classForm->relkind != RELKIND_VIEW && classForm->relkind != RELKIND_VIEW &&
!superuser_arg(roleid) && !superuser_arg(roleid))
!allowSystemTableMods)
{ {
#ifdef ACLDEBUG #ifdef ACLDEBUG
elog(DEBUG2, "permission denied for system catalog update"); elog(DEBUG2, "permission denied for system catalog update");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment