Make WordPress Core


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

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

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

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

    r55789 r56876  
    35113511    $shortcode = wp_unslash( $_POST['shortcode'] );
    35123512
     3513    // Only process previews for media related shortcodes:
     3514    $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3515    $media_shortcodes = array(
     3516        'audio',
     3517        'embed',
     3518        'playlist',
     3519        'video',
     3520        'gallery',
     3521    );
     3522
     3523    $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3524
     3525    if ( ! empty( $other_shortcodes ) ) {
     3526        wp_send_json_error();
     3527    }
     3528
    35133529    if ( ! empty( $_POST['post_ID'] ) ) {
    35143530        $post = get_post( (int) $_POST['post_ID'] );
     
    35173533    // the embed shortcode requires a post
    35183534    if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3519         if ( 'embed' === $shortcode ) {
     3535        if ( in_array( 'embed', $found_shortcodes, true ) ) {
    35203536            wp_send_json_error();
    35213537        }
Note: See TracChangeset for help on using the changeset viewer.