Skip to content
Snippets Groups Projects
user avatar
Noah Misch authored
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
15a8f97b
History
Name Last commit Last update
..
abort.sgml
allfiles.sgml
alter_aggregate.sgml
alter_collation.sgml
alter_conversion.sgml
alter_database.sgml
alter_default_privileges.sgml
alter_domain.sgml
alter_extension.sgml
alter_foreign_data_wrapper.sgml
alter_foreign_table.sgml
alter_function.sgml
alter_group.sgml
alter_index.sgml
alter_language.sgml
alter_large_object.sgml
alter_opclass.sgml
alter_operator.sgml
alter_opfamily.sgml
alter_role.sgml
alter_schema.sgml
alter_sequence.sgml
alter_server.sgml
alter_table.sgml
alter_tablespace.sgml
alter_trigger.sgml
alter_tsconfig.sgml
alter_tsdictionary.sgml
alter_tsparser.sgml
alter_tstemplate.sgml
alter_type.sgml
alter_user.sgml
alter_user_mapping.sgml
alter_view.sgml
analyze.sgml
begin.sgml
checkpoint.sgml
close.sgml
cluster.sgml
clusterdb.sgml
comment.sgml
commit.sgml
commit_prepared.sgml
copy.sgml
create_aggregate.sgml
create_cast.sgml
create_collation.sgml
create_conversion.sgml
create_database.sgml
create_domain.sgml
create_extension.sgml
create_foreign_data_wrapper.sgml
create_foreign_table.sgml
create_function.sgml
create_group.sgml
create_index.sgml
create_language.sgml
create_opclass.sgml
create_operator.sgml
create_opfamily.sgml
create_role.sgml
create_rule.sgml
create_schema.sgml
create_sequence.sgml
create_server.sgml
create_table.sgml
create_table_as.sgml
create_tablespace.sgml
create_trigger.sgml
create_tsconfig.sgml
create_tsdictionary.sgml
create_tsparser.sgml
create_tstemplate.sgml
create_type.sgml
create_user.sgml
create_user_mapping.sgml
create_view.sgml
createdb.sgml
createlang.sgml
createuser.sgml
deallocate.sgml
declare.sgml
delete.sgml
discard.sgml
do.sgml
drop_aggregate.sgml
drop_cast.sgml
drop_collation.sgml
drop_conversion.sgml
drop_database.sgml
drop_domain.sgml
drop_extension.sgml
drop_foreign_data_wrapper.sgml
drop_foreign_table.sgml
drop_function.sgml
drop_group.sgml
drop_index.sgml
drop_language.sgml
drop_opclass.sgml
drop_operator.sgml