Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:05:46 PM (21 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 5.3 branch.

  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Shortcodes: Restrict media shortcode ajax to certain type.
  • REST API: Ensure no-cache headers are sent when methods are overridden.
  • REST API: Limit search_columns for users without list_users.
  • Prevent unintended behavior when certain objects are unserialized.

Merges [56833], [56834], [56835], [56836], and [56838] to the 5.3 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/media.php

    r55788 r56877  
    18731873        }
    18741874    } elseif ( ! empty( $atts['exclude'] ) ) {
    1875         $attachments = get_children(
     1875        $post_parent_id = $id;
     1876        $attachments    = get_children(
    18761877            array(
    18771878                'post_parent'    => $id,
     
    18851886        );
    18861887    } else {
    1887         $attachments = get_children(
     1888        $post_parent_id = $id;
     1889        $attachments    = get_children(
    18881890            array(
    18891891                'post_parent'    => $id,
     
    18951897            )
    18961898        );
     1899    }
     1900
     1901    if ( ! empty( $post_parent_id ) ) {
     1902        $post_parent = get_post( $post_parent_id );
     1903
     1904        // terminate the shortcode execution if user cannot read the post or password-protected
     1905        if (
     1906        ( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
     1907        || post_password_required( $post_parent ) ) {
     1908            return '';
     1909        }
    18971910    }
    18981911
     
    22152228    }
    22162229
     2230    if ( ! empty( $args['post_parent'] ) ) {
     2231        $post_parent = get_post( $id );
     2232
     2233        // terminate the shortcode execution if user cannot read the post or password-protected
     2234        if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
     2235            return '';
     2236        }
     2237    }
     2238
    22172239    if ( empty( $attachments ) ) {
    22182240        return '';
Note: See TracChangeset for help on using the changeset viewer.