Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:06:49 PM (16 months ago)
Author:
davidbaumwald
Message:

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

Location:
branches/5.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.4

  • branches/5.4/src/wp-admin/includes/ajax-actions.php

    r55785 r56878  
    37403740    $shortcode = wp_unslash( $_POST['shortcode'] );
    37413741
     3742    // Only process previews for media related shortcodes:
     3743    $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3744    $media_shortcodes = array(
     3745        'audio',
     3746        'embed',
     3747        'playlist',
     3748        'video',
     3749        'gallery',
     3750    );
     3751
     3752    $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3753
     3754    if ( ! empty( $other_shortcodes ) ) {
     3755        wp_send_json_error();
     3756    }
     3757
    37423758    if ( ! empty( $_POST['post_ID'] ) ) {
    37433759        $post = get_post( (int) $_POST['post_ID'] );
     
    37463762    // The embed shortcode requires a post.
    37473763    if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3748         if ( 'embed' === $shortcode ) {
     3764        if ( in_array( 'embed', $found_shortcodes, true ) ) {
    37493765            wp_send_json_error();
    37503766        }
Note: See TracChangeset for help on using the changeset viewer.