1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Fix privilege check for SET SESSION AUTHORIZATION.

Presently, the privilege check for SET SESSION AUTHORIZATION checks
whether the original authenticated role was a superuser at
connection start time.  Even if the role loses the superuser
attribute, its existing sessions are permitted to change session
authorization to any role.

This commit modifies this privilege check to verify the original
authenticated role currently has superuser.  In the event that the
authenticated role loses superuser within a session authorization
change, the authorization change will remain in effect, which means
the user can still take advantage of the target role's privileges.
However, [RE]SET SESSION AUTHORIZATION will only permit switching
to the original authenticated role.

Author: Joseph Koshakow
Discussion: https://postgr.es/m/CAAvxfHc-HHzONQ2oXdvhFF9ayRnidPwK%2BfVBhRzaBWYYLVQL-g%40mail.gmail.com
This commit is contained in:
Nathan Bossart
2023-07-13 21:13:45 -07:00
parent 9987a7bf34
commit a0363ab7aa
4 changed files with 10 additions and 23 deletions

View File

@@ -51,7 +51,7 @@ RESET SESSION AUTHORIZATION
<para>
The session user identifier can be changed only if the initial session
user (the <firstterm>authenticated user</firstterm>) had the
user (the <firstterm>authenticated user</firstterm>) has the
superuser privilege. Otherwise, the command is accepted only if it
specifies the authenticated user name.
</para>