Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:59:28 PM (3 years ago)
Author:
davidbaumwald
Message:

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

File:
1 edited

Legend:

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

    r55791 r56871  
    16881688                }
    16891689        } elseif ( ! empty( $atts['exclude'] ) ) {
     1690                $post_parent_id = $id;
    16901691                $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'] ) );
    16911692        } else {
     1693                $post_parent_id = $id;
    16921694                $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
     1695        }
     1696
     1697        if ( ! empty( $post_parent_id ) ) {
     1698                $post_parent = get_post( $post_parent_id );
     1699
     1700                // terminate the shortcode execution if user cannot read the post or password-protected
     1701                if (
     1702                ( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
     1703                || post_password_required( $post_parent ) ) {
     1704                        return '';
     1705                }
    16931706        }
    16941707
    … …  
    19922005        }
    19932006
     2007        if ( ! empty( $args['post_parent'] ) ) {
     2008                $post_parent = get_post( $id );
     2009
     2010                // terminate the shortcode execution if user cannot read the post or password-protected
     2011                if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
     2012                        return '';
     2013                }
     2014        }
     2015
    19942016        if ( empty( $attachments ) ) {
    19952017                return '';
Note: See TracChangeset for help on using the changeset viewer.