Skip to content

Commit 533ab8f

Browse files
fix: better security for some rest endpoints
1 parent cc9cfab commit 533ab8f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/block/posts/index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,12 @@ public static function get_terms() {
526526
public function get_posts( $request ) {
527527
$args = $request->get_query_params();
528528

529+
// Enforce safe defaults to avoid exposing sensitive content.
530+
// 1) Force post status to publish only (non-sensitive).
531+
$args['post_status'] = 'publish';
532+
// 2) Exclude password-protected content explicitly.
533+
$args['has_password'] = false;
534+
529535
$query = new WP_Query( $args );
530536

531537
foreach ( $query->posts as $key=>$post ) {

src/design-library/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function register_route() {
7676
'methods' => 'POST',
7777
'callback' => array( $this, 'get_design_library_image' ),
7878
'permission_callback' => function () {
79-
return current_user_can( 'edit_posts' );
79+
return current_user_can( 'upload_files' );
8080
},
8181
'args' => array(
8282
'image_url' => array(

0 commit comments

Comments
 (0)