postgresql/src/backend/commands
Noah Misch fea164a72a Shore up ADMIN OPTION restrictions.
Granting a role without ADMIN OPTION is supposed to prevent the grantee
from adding or removing members from the granted role.  Issuing SET ROLE
before the GRANT bypassed that, because the role itself had an implicit
right to add or remove members.  Plug that hole by recognizing that
implicit right only when the session user matches the current role.
Additionally, do not recognize it during a security-restricted operation
or during execution of a SECURITY DEFINER function.  The restriction on
SECURITY DEFINER is not security-critical.  However, it seems best for a
user testing his own SECURITY DEFINER function to see the same behavior
others will see.  Back-patch to 8.4 (all supported versions).

The SQL standards do not conflate roles and users as PostgreSQL does;
only SQL roles have members, and only SQL users initiate sessions.  An
application using PostgreSQL users and roles as SQL users and roles will
never attempt to grant membership in the role that is the session user,
so the implicit right to add or remove members will never arise.

The security impact was mostly that a role member could revoke access
from others, contrary to the wishes of his own grantor.  Unapproved role
member additions are less notable, because the member can still largely
achieve that by creating a view or a SECURITY DEFINER function.

Reviewed by Andres Freund and Tom Lane.  Reported, independently, by
Jonas Sundman and Noah Misch.

Security: CVE-2014-0060
2014-02-17 09:33:31 -05:00
..
aggregatecmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
alter.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
analyze.c Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD. 2014-01-11 13:42:42 -05:00
async.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
cluster.c Separate multixact freezing parameters from xid's 2014-02-13 19:36:31 -03:00
collationcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
comment.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
constraint.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
conversioncmds.c Make various variables const (read-only). 2014-01-18 16:04:32 -05:00
copy.c Speed up COPY into tables with DEFAULT nextval() 2014-01-20 17:22:38 +00:00
createas.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dbcommands.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
define.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
discard.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dropcmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
event_trigger.c Mark some more variables as static or include the appropriate header 2014-02-08 21:21:46 -05:00
explain.c Include planning time in EXPLAIN ANALYZE output. 2014-01-29 16:09:15 -05:00
extension.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
foreigncmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
functioncmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
indexcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
lockcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Add a materialized view relations. 2013-03-03 18:23:31 -06:00
matview.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
opclasscmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
operatorcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
portalcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
prepare.c Include planning time in EXPLAIN ANALYZE output. 2014-01-29 16:09:15 -05:00
proclang.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
schemacmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
seclabel.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
sequence.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tablecmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
tablespace.c Fix unsafe references to errno within error messaging logic. 2014-01-29 20:04:43 -05:00
trigger.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tsearchcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
typecmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
user.c Shore up ADMIN OPTION restrictions. 2014-02-17 09:33:31 -05:00
vacuum.c Separate multixact freezing parameters from xid's 2014-02-13 19:36:31 -03:00
vacuumlazy.c Separate multixact freezing parameters from xid's 2014-02-13 19:36:31 -03:00
variable.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
view.c Update copyright for 2014 2014-01-07 16:05:30 -05:00