Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:50:31 PM (16 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.8 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 [56834], [56835], [56836], [56838], and [56840] to the 4.8 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8/src/wp-admin/includes/ajax-actions.php

    r55786 r56864  
    31133113    $shortcode = wp_unslash( $_POST['shortcode'] );
    31143114
     3115    // Only process previews for media related shortcodes:
     3116    $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3117    $media_shortcodes = array(
     3118        'audio',
     3119        'embed',
     3120        'playlist',
     3121        'video',
     3122        'gallery',
     3123    );
     3124
     3125    $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3126
     3127    if ( ! empty( $other_shortcodes ) ) {
     3128        wp_send_json_error();
     3129    }
     3130
    31153131    if ( ! empty( $_POST['post_ID'] ) ) {
    31163132        $post = get_post( (int) $_POST['post_ID'] );
     
    31193135    // the embed shortcode requires a post
    31203136    if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3121         if ( 'embed' === $shortcode ) {
     3137        if ( in_array( 'embed', $found_shortcodes, true ) ) {
    31223138            wp_send_json_error();
    31233139        }
Note: See TracChangeset for help on using the changeset viewer.