Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:14:45 PM (3 years ago)
Author:
joemcgill
Message:

Grouped backports to the 5.8 branch.

  • REST API: Limit search_columns for users without list_users.
  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Application Passwords: Prevent the use of some pseudo protocols in application passwords.
  • Restrict media shortcode ajax to certain type
  • REST API: Ensure no-cache headers are sent when methods are overriden.
  • Prevent unintended behavior when certain objects are unserialized.

Merges [56833], [56834], [56835], [56836], [56837], and [56838] to the 5.8 branch.
Props xknown, jorbin, Vortfu, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, martinkrcho, paulkevan, dd32, antpb, rmccue.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

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

    r55777 r56884  
    37833783        $shortcode = wp_unslash( $_POST['shortcode'] );
    37843784
     3785        // Only process previews for media related shortcodes:
     3786        $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3787        $media_shortcodes = array(
     3788                'audio',
     3789                'embed',
     3790                'playlist',
     3791                'video',
     3792                'gallery',
     3793        );
     3794
     3795        $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3796
     3797        if ( ! empty( $other_shortcodes ) ) {
     3798                wp_send_json_error();
     3799        }
     3800
    37853801        if ( ! empty( $_POST['post_ID'] ) ) {
    37863802                $post = get_post( (int) $_POST['post_ID'] );
    … …  
    37893805        // The embed shortcode requires a post.
    37903806        if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3791                 if ( 'embed' === $shortcode ) {
     3807                if ( in_array( 'embed', $found_shortcodes, true ) ) {
    37923808                        wp_send_json_error();
    37933809                }
Note: See TracChangeset for help on using the changeset viewer.