Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:02:41 PM (3 years ago)
Author:
davidbaumwald
Message:

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

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

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

    r55790 r56873  
    34973497        $shortcode = wp_unslash( $_POST['shortcode'] );
    34983498
     3499        // Only process previews for media related shortcodes:
     3500        $found_shortcodes = get_shortcode_tags_in_content( $shortcode );
     3501        $media_shortcodes = array(
     3502                'audio',
     3503                'embed',
     3504                'playlist',
     3505                'video',
     3506                'gallery',
     3507        );
     3508
     3509        $other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
     3510
     3511        if ( ! empty( $other_shortcodes ) ) {
     3512                wp_send_json_error();
     3513        }
     3514
    34993515        if ( ! empty( $_POST['post_ID'] ) ) {
    35003516                $post = get_post( (int) $_POST['post_ID'] );
    … …  
    35033519        // the embed shortcode requires a post
    35043520        if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
    3505                 if ( 'embed' === $shortcode ) {
     3521                if ( in_array( 'embed', $found_shortcodes, true ) ) {
    35063522                        wp_send_json_error();
    35073523                }
Note: See TracChangeset for help on using the changeset viewer.