Make WordPress Core


Ignore:
Timestamp:
12/12/2019 06:51:11 PM (6 years ago)
Author:
whyisjake
Message:

Ensure that a user can publish_posts before making a post sticky.
Props: danielbachhuber, whyisjake, peterwilson, xknown.
Prevent stored XSS through wp_targeted_link_rel().
Props: vortfu, whyisjake, peterwilsoncc, xknown, SergeyBiryukov, flaviozavan.
Update wp_kses_bad_protocol() to recognize : on uri attributes,
wp_kses_bad_protocol() makes sure to validate that uri attributes don't contain invalid/or not allowed protocols. While this works fine in most cases, there's a risk that by using the colon html5 named entity, one is able to bypass this function.
Brings r46895 to the 5.3 branch.
Props: xknown, nickdaugherty, peterwilsoncc.
Prevent stored XSS in the block editor.
Brings r46896 to the 5.3 branch.
Prevent escaped unicode characters become unescaped in unsafe HTML during JSON decoding.
Props: aduth, epiqueras.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/src/wp-includes/formatting.php

    r45993 r46915  
    44044404
    44054405/**
     4406 * Remove non-allowable HTML from parsed block attribute values when filtering
     4407 * in the post context.
     4408 *
     4409 * @since 5.3.1
     4410 *
     4411 * @param string         $string            Content to be run through KSES.
     4412 * @param array[]|string $allowed_html      An array of allowed HTML elements
     4413 *                                          and attributes, or a context name
     4414 *                                          such as 'post'.
     4415 * @param string[]       $allowed_protocols Array of allowed URL protocols.
     4416 * @return string Filtered text to run through KSES.
     4417 */
     4418function wp_pre_kses_block_attributes( $string, $allowed_html, $allowed_protocols ) {
     4419    /*
     4420     * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
     4421     * the filter to avoid recursion.
     4422     */
     4423    remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
     4424    $string = filter_block_content( $string, $allowed_html, $allowed_protocols );
     4425    add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
     4426
     4427    return $string;
     4428}
     4429
     4430/**
    44064431 * WordPress implementation of PHP sprintf() with filters.
    44074432 *
Note: See TracChangeset for help on using the changeset viewer.