Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:15:04 PM (8 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 5.7 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.
  • Application Passwords: Prevent the use of some pseudo protocols in application passwords.

Merges [56833], [56834], [56835], [56836], [56837], and [56838] to the 5.7 branch.
Props xknown, jorbin, Vortfu, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, martinkrcho, paulkevan, dd32, antpb, rmccue.

Location:
branches/5.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.7

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

    r55778 r56886  
    23392339        }
    23402340    } elseif ( ! empty( $atts['exclude'] ) ) {
     2341        $post_parent_id = $id;
    23412342        $attachments = get_children(
    23422343            array(
     
    23512352        );
    23522353    } else {
     2354        $post_parent_id = $id;
    23532355        $attachments = get_children(
    23542356            array(
     
    23612363            )
    23622364        );
     2365    }
     2366
     2367    if ( ! empty( $post_parent_id ) ) {
     2368        $post_parent = get_post( $post_parent_id );
     2369
     2370        // terminate the shortcode execution if user cannot read the post or password-protected
     2371        if (
     2372        ( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
     2373        || post_password_required( $post_parent ) ) {
     2374            return '';
     2375        }
    23632376    }
    23642377
     
    26892702    }
    26902703
     2704    if ( ! empty( $args['post_parent'] ) ) {
     2705        $post_parent = get_post( $id );
     2706
     2707        // terminate the shortcode execution if user cannot read the post or password-protected
     2708        if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
     2709            return '';
     2710        }
     2711    }
     2712
    26912713    if ( empty( $attachments ) ) {
    26922714        return '';
Note: See TracChangeset for help on using the changeset viewer.