Skip to content

Commit 1d0b575

Browse files
committed
fix(import): add read_post permission check
Verify the user can read the source post before importing its content. Prevents leaking private post content across blogs. Closes #610
1 parent bb54059 commit 1d0b575

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

includes/ContentImport/ContentImporter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ public function handle_import( array $data = array() ) {
110110
return $data;
111111
}
112112

113+
switch_to_blog( $source_blog_id );
114+
$can_read = current_user_can( 'read_post', $source_post_id );
115+
restore_current_blog();
116+
117+
if ( ! $can_read ) {
118+
return $data;
119+
}
120+
113121
$source_lang = MslsBlogCollection::get_blog_language( $source_blog_id );
114122
$dest_blog_id = get_current_blog_id();
115123
$dest_lang = MslsBlogCollection::get_blog_language( get_current_blog_id() );

0 commit comments

Comments
 (0)