Opened 17 years ago
Closed 15 years ago
#6566 closed defect (bug) (wontfix)
custom-built roles can create administrator users
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 2.5 |
Component: | Security | Keywords: | capabilities close |
Focuses: | Cc: |
Description
If you create a custom role using the role manager, and let that role edit options for any reasons (e.g. you want to set up some kind of demo site), then users with that role can open registrations, and assign administrator as the default role, then let themselves in as administrator.
Fix:
function default_role($o) { if ( $o == 'administrator' && get_option('users_can_register') ) { global $wp_roles; foreach ( $wp_roles->role_names as $role => $name ) { if ( $role != 'administrator' ) { $o = $role; add_action('shutdown', create_function('', "update_option('default_role', '$role');")); break; } } } return $o; } # default_role() add_filter('option_default_role', 'default_role');
Change History (5)
#1
@
17 years ago
- Keywords capabilities added
- Milestone 2.5.2 deleted
- Resolution set to invalid
- Status changed from new to closed
#2
@
15 years ago
- Milestone set to 3.0
true, but this prevents anyone from creating a proper demo site.
#4
@
15 years ago
- Keywords close added
This is IMO, a wontfix.
If you wish to have a demo site, with people being able to edit options, Then you need to lock certain options down. Its nothing new, You have a user that can change security-related then they must be trusted.
Add a filter to the sanitization hook for that function, and always return the old setting. Job done.
Note: See
TracTickets for help on using
tickets.
This is by design. The edit_options capability is intended to allow a user to edit options ;-) . See also #6014.
I've discussed these sorts of issues with the author of the role manager plugin and the conclusion seems to be that if you're not sure what each capability actually allows, you shouldn't be messing with them :-)
It may be a documentation issue but I'm reluctant to accept it as a bug so I'm going to close for now.