Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:05:46 PM (4 months ago)
Author:
davidbaumwald
Message:

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

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

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

    r55788 r56877  
    37363736    $shortcode = wp_unslash( $_POST['shortcode'] );
    37373737
     3738    // Only process previews for media related shortcodes:
     3739    $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3740    $media_shortcodes = array(
     3741        'audio',
     3742        'embed',
     3743        'playlist',
     3744        'video',
     3745        'gallery',
     3746    );
     3747
     3748    $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3749
     3750    if ( ! empty( $other_shortcodes ) ) {
     3751        wp_send_json_error();
     3752    }
     3753
    37383754    if ( ! empty( $_POST['post_ID'] ) ) {
    37393755        $post = get_post( (int) $_POST['post_ID'] );
     
    37423758    // the embed shortcode requires a post
    37433759    if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3744         if ( 'embed' === $shortcode ) {
     3760        if ( in_array( 'embed', $found_shortcodes, true ) ) {
    37453761            wp_send_json_error();
    37463762        }
Note: See TracChangeset for help on using the changeset viewer.