Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disclosed vulnerability affecting Contributor-level users #42

Merged
merged 3 commits into from
Oct 13, 2023

Conversation

hsein-bitar
Copy link
Contributor

@hsein-bitar hsein-bitar commented Oct 10, 2023

Asana

https://app.asana.com/0/1202852195727075/1205661585628058/f

Context

Fix vulnerability in Draw Attention plugin
code changes to prevent users below admin or editor roles from doing an import or export

@hsein-bitar
Copy link
Contributor Author

@hsein-bitar hsein-bitar marked this pull request as ready for review October 10, 2023 19:17
@tylerdigital tylerdigital changed the title Fix vulnerability in Draw Attention plugin Fix disclosed vulnerability affecting Contributor-level users Oct 11, 2023
}

public function output_import_export_page() {
// only allow admins and editors
$user = wp_get_current_user();
if( ! array_intersect( array('administrator', 'editor' ), (array) $user->roles ) ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hsein-bitar I believe we want to bind to the capability here rather than the role. As written, only the default WP roles would work, but if you make a new custom role (using a plugin like Members) like Content Manager that has the ability to delete_others_posts, then it should still let you see this page. Another case would be if they modify the default Editor role so that it doesn't have permission to delete others' posts for some reason. For these cases, we want to test the capability rather than the role

I'd just make this function call if ( current_user_can( 'delete_others_posts' ) ) so that it tests for the actual capability we want rather than explicitly checking the role

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tylerdigital thanks for the tip

@tylerdigital tylerdigital merged commit d36f2e1 into master Oct 13, 2023
9 checks passed
@tylerdigital tylerdigital deleted the vuln-fix branch October 13, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants