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-admin/includes/ajax-actions.php

    r55791 r56871  
    31393139    $shortcode = wp_unslash( $_POST['shortcode'] );
    31403140
     3141    // Only process previews for media related shortcodes:
     3142    $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3143    $media_shortcodes = array(
     3144        'audio',
     3145        'embed',
     3146        'playlist',
     3147        'video',
     3148        'gallery',
     3149    );
     3150
     3151    $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3152
     3153    if ( ! empty( $other_shortcodes ) ) {
     3154        wp_send_json_error();
     3155    }
     3156
    31413157    if ( ! empty( $_POST['post_ID'] ) ) {
    31423158        $post = get_post( (int) $_POST['post_ID'] );
     
    31453161    // the embed shortcode requires a post
    31463162    if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3147         if ( 'embed' === $shortcode ) {
     3163        if ( in_array( 'embed', $found_shortcodes, true ) ) {
    31483164            wp_send_json_error();
    31493165        }
Note: See TracChangeset for help on using the changeset viewer.