Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:50:31 PM (9 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.8 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 [56834], [56835], [56836], [56838], and [56840] to the 4.8 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8/src/wp-includes/media.php

    r55786 r56864  
    16901690        }
    16911691    } elseif ( ! empty( $atts['exclude'] ) ) {
     1692        $post_parent_id = $id;
    16921693        $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
    16931694    } else {
     1695        $post_parent_id = $id;
    16941696        $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
     1697    }
     1698
     1699    if ( ! empty( $post_parent_id ) ) {
     1700        $post_parent = get_post( $post_parent_id );
     1701
     1702        // terminate the shortcode execution if user cannot read the post or password-protected
     1703        if (
     1704        ( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
     1705        || post_password_required( $post_parent ) ) {
     1706            return '';
     1707        }
    16951708    }
    16961709
     
    19942007    }
    19952008
     2009    if ( ! empty( $args['post_parent'] ) ) {
     2010        $post_parent = get_post( $id );
     2011
     2012        // terminate the shortcode execution if user cannot read the post or password-protected
     2013        if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
     2014            return '';
     2015        }
     2016    }
     2017
    19962018    if ( empty( $attachments ) ) {
    19972019        return '';
Note: See TracChangeset for help on using the changeset viewer.