Disallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 0ed2edfaae9016fb399c27c233d8e0c982a4921a
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2009-09-03T22:08:45Z
Releases: 8.1.18
Disallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer
functions.

This extends the previous patch that forbade SETting these variables inside
security-definer functions.  RESET is equally a security hole, since it
would allow regaining privileges of the caller; furthermore it can trigger
Assert failures and perhaps other internal errors, since the code is not
expecting these variables to change in such contexts.  The previous patch
did not cover this case because assign hooks don't really have enough
information, so move the responsibility for preventing this into guc.c.

Problem discovered by Heikki Linnakangas.

Security: no CVE assigned yet, extends CVE-2007-6600

Files

PathChange+/−
src/backend/commands/variable.c modified +1 −36
src/backend/utils/misc/guc.c modified +29 −3
src/include/utils/guc_tables.h modified +3 −1