Skip to content

Commit 7622f11

Browse files
Add authorization check on destination post during content import (#668)
The content-import filter already verified the requesting user could read the source post and validated the nonce, but never checked whether they were allowed to edit the destination post before writing imported content into it. Add an explicit current_user_can( 'edit_post', $dest_post_id ) check alongside the existing checks.
1 parent 06e4a43 commit 7622f11

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

includes/ContentImport/ContentImporter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ public function handle_import( array $data = array() ) {
133133
return $data;
134134
}
135135

136+
if ( ! current_user_can( 'edit_post', $dest_post_id ) ) {
137+
return $data;
138+
}
139+
136140
$import_coordinates = new ImportCoordinates();
137141

138142
$import_coordinates->source_blog_id = $source_blog_id;

0 commit comments

Comments
 (0)