Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:09:08 PM (19 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 5.5 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.5 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

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

    r55782 r56880  
    22312231        }
    22322232    } elseif ( ! empty( $atts['exclude'] ) ) {
     2233        $post_parent_id = $id;
    22332234        $attachments = get_children(
    22342235            array(
     
    22432244        );
    22442245    } else {
     2246        $post_parent_id = $id;
    22452247        $attachments = get_children(
    22462248            array(
     
    22532255            )
    22542256        );
     2257    }
     2258
     2259    if ( ! empty( $post_parent_id ) ) {
     2260        $post_parent = get_post( $post_parent_id );
     2261
     2262        // terminate the shortcode execution if user cannot read the post or password-protected
     2263        if (
     2264        ( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
     2265        || post_password_required( $post_parent ) ) {
     2266            return '';
     2267        }
    22552268    }
    22562269
     
    25812594    }
    25822595
     2596    if ( ! empty( $args['post_parent'] ) ) {
     2597        $post_parent = get_post( $id );
     2598
     2599        // terminate the shortcode execution if user cannot read the post or password-protected
     2600        if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
     2601            return '';
     2602        }
     2603    }
     2604
    25832605    if ( empty( $attachments ) ) {
    25842606        return '';
Note: See TracChangeset for help on using the changeset viewer.