pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
4+ messages / 1 participants
[nested] [flat]

* pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNER TO.

Commit 3d14e171e9e2236139e8976f3309a588bcc8683b (v16) made giving an
object to another role depend on the ability to SET ROLE to that role.
However, a role granted "INHERIT TRUE, SET FALSE" could bypass that, via
REASSIGN OWNED.  A role granted "INHERIT FALSE, SET TRUE" saw the
inverse problem: REASSIGN OWNED failed spuriously, while ALTER ... OWNER
succeeded.

For avoidance of doubt, fixing this doesn't change the limitations of
SET FALSE.  If a role owns nothing, SET FALSE grantees can't make that
role own its first object.  For many kinds of objects, once a role owns
one, "INHERIT TRUE, SET FALSE" prevents nothing compared to "INHERIT
TRUE, SET TRUE".

REASSIGN OWNED also bypassed the CREATEDB privilege check in ALTER
DATABASE ... OWNER TO.  Fix by duplicating the check.  This affects all
supported versions.  This sort of omission remains easy to miss under
the present design, so refactoring would be prudent.

Document the way REASSIGN OWNED still differs from ALTER ... OWNER TO:
the new owner's CREATE privilege on the schema of a relation or type is
not checked.

Back-patch to v14 (all supported versions).  In v15 and v14, REASSIGN
OWNED's privs checks is stricter than the membership checks in ALTER
... OWNER TO.  Leave that alone, rather than aligning the commands.  Do
fix the CREATEDB omission.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Backpatch-through: 14
Security: CVE-2026-120146

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b2f1afd9f132f5fb41006172bbe1a36b37150a00

Modified Files
--------------
doc/src/sgml/ref/reassign_owned.sgml      |  7 +++++--
src/backend/catalog/pg_shdepend.c         | 34 ++++++++++++++++++++++++++++---
src/backend/commands/user.c               | 10 ++-------
src/test/regress/expected/create_role.out |  3 +++
src/test/regress/expected/database.out    | 19 +++++++++++++++++
src/test/regress/expected/dependency.out  |  3 +--
src/test/regress/sql/create_role.sql      |  2 ++
src/test/regress/sql/database.sql         | 12 +++++++++++
8 files changed, 75 insertions(+), 15 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNER TO.

Commit 3d14e171e9e2236139e8976f3309a588bcc8683b (v16) made giving an
object to another role depend on the ability to SET ROLE to that role.
However, a role granted "INHERIT TRUE, SET FALSE" could bypass that, via
REASSIGN OWNED.  A role granted "INHERIT FALSE, SET TRUE" saw the
inverse problem: REASSIGN OWNED failed spuriously, while ALTER ... OWNER
succeeded.

For avoidance of doubt, fixing this doesn't change the limitations of
SET FALSE.  If a role owns nothing, SET FALSE grantees can't make that
role own its first object.  For many kinds of objects, once a role owns
one, "INHERIT TRUE, SET FALSE" prevents nothing compared to "INHERIT
TRUE, SET TRUE".

REASSIGN OWNED also bypassed the CREATEDB privilege check in ALTER
DATABASE ... OWNER TO.  Fix by duplicating the check.  This affects all
supported versions.  This sort of omission remains easy to miss under
the present design, so refactoring would be prudent.

Document the way REASSIGN OWNED still differs from ALTER ... OWNER TO:
the new owner's CREATE privilege on the schema of a relation or type is
not checked.

Back-patch to v14 (all supported versions).  In v15 and v14, REASSIGN
OWNED's privs checks is stricter than the membership checks in ALTER
... OWNER TO.  Leave that alone, rather than aligning the commands.  Do
fix the CREATEDB omission.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Backpatch-through: 14
Security: CVE-2026-120146

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5b6f8c9749d2af2714f4c8c2b4de8b465cac5bb9

Modified Files
--------------
doc/src/sgml/ref/reassign_owned.sgml      |  7 +++++--
src/backend/catalog/pg_shdepend.c         | 34 ++++++++++++++++++++++++++++---
src/backend/commands/user.c               | 10 ++-------
src/test/regress/expected/create_role.out |  3 +++
src/test/regress/expected/database.out    | 19 +++++++++++++++++
src/test/regress/expected/dependency.out  |  3 +--
src/test/regress/sql/create_role.sql      |  2 ++
src/test/regress/sql/database.sql         | 12 +++++++++++
8 files changed, 75 insertions(+), 15 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
@ 2026-11-09 14:22 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNER TO.

Commit 3d14e171e9e2236139e8976f3309a588bcc8683b (v16) made giving an
object to another role depend on the ability to SET ROLE to that role.
However, a role granted "INHERIT TRUE, SET FALSE" could bypass that, via
REASSIGN OWNED.  A role granted "INHERIT FALSE, SET TRUE" saw the
inverse problem: REASSIGN OWNED failed spuriously, while ALTER ... OWNER
succeeded.

For avoidance of doubt, fixing this doesn't change the limitations of
SET FALSE.  If a role owns nothing, SET FALSE grantees can't make that
role own its first object.  For many kinds of objects, once a role owns
one, "INHERIT TRUE, SET FALSE" prevents nothing compared to "INHERIT
TRUE, SET TRUE".

REASSIGN OWNED also bypassed the CREATEDB privilege check in ALTER
DATABASE ... OWNER TO.  Fix by duplicating the check.  This affects all
supported versions.  This sort of omission remains easy to miss under
the present design, so refactoring would be prudent.

Document the way REASSIGN OWNED still differs from ALTER ... OWNER TO:
the new owner's CREATE privilege on the schema of a relation or type is
not checked.

Back-patch to v14 (all supported versions).  In v15 and v14, REASSIGN
OWNED's privs checks is stricter than the membership checks in ALTER
... OWNER TO.  Leave that alone, rather than aligning the commands.  Do
fix the CREATEDB omission.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Backpatch-through: 14
Security: CVE-2026-120146

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ea228688e252b5d8767cc1bded8e327abb0f3abf

Modified Files
--------------
doc/src/sgml/ref/reassign_owned.sgml      |  7 +++++--
src/backend/catalog/pg_shdepend.c         | 33 ++++++++++++++++++++++++++++---
src/backend/commands/user.c               | 10 ++--------
src/test/regress/expected/create_role.out |  3 +++
src/test/regress/expected/database.out    | 19 ++++++++++++++++++
src/test/regress/expected/dependency.out  |  3 +--
src/test/regress/sql/create_role.sql      |  2 ++
src/test/regress/sql/database.sql         | 12 +++++++++++
8 files changed, 74 insertions(+), 15 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE
@ 2026-11-09 14:22 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNER TO.

Commit 3d14e171e9e2236139e8976f3309a588bcc8683b (v16) made giving an
object to another role depend on the ability to SET ROLE to that role.
However, a role granted "INHERIT TRUE, SET FALSE" could bypass that, via
REASSIGN OWNED.  A role granted "INHERIT FALSE, SET TRUE" saw the
inverse problem: REASSIGN OWNED failed spuriously, while ALTER ... OWNER
succeeded.

For avoidance of doubt, fixing this doesn't change the limitations of
SET FALSE.  If a role owns nothing, SET FALSE grantees can't make that
role own its first object.  For many kinds of objects, once a role owns
one, "INHERIT TRUE, SET FALSE" prevents nothing compared to "INHERIT
TRUE, SET TRUE".

REASSIGN OWNED also bypassed the CREATEDB privilege check in ALTER
DATABASE ... OWNER TO.  Fix by duplicating the check.  This affects all
supported versions.  This sort of omission remains easy to miss under
the present design, so refactoring would be prudent.

Document the way REASSIGN OWNED still differs from ALTER ... OWNER TO:
the new owner's CREATE privilege on the schema of a relation or type is
not checked.

Back-patch to v14 (all supported versions).  In v15 and v14, REASSIGN
OWNED's privs checks is stricter than the membership checks in ALTER
... OWNER TO.  Leave that alone, rather than aligning the commands.  Do
fix the CREATEDB omission.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Backpatch-through: 14
Security: CVE-2026-120146

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0b8d1768f2def0800b651aee63447aea79b1493d

Modified Files
--------------
doc/src/sgml/ref/reassign_owned.sgml      |  7 +++++--
src/backend/catalog/pg_shdepend.c         | 33 ++++++++++++++++++++++++++++---
src/backend/commands/user.c               | 10 ++--------
src/test/regress/expected/create_role.out |  3 +++
src/test/regress/expected/database.out    | 19 ++++++++++++++++++
src/test/regress/expected/dependency.out  |  3 +--
src/test/regress/sql/create_role.sql      |  2 ++
src/test/regress/sql/database.sql         | 12 +++++++++++
8 files changed, 74 insertions(+), 15 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-11-09 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:21 pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE Noah Misch <noah@leadboat.com>
2026-11-09 14:22 pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE Noah Misch <noah@leadboat.com>
2026-11-09 14:22 pgsql: Align REASSIGN OWNED caller-privilege checks with ALTER ... OWNE Noah Misch <noah@leadboat.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox