Make WordPress Core


Ignore:
Timestamp:
01/26/2026 03:17:00 PM (5 months ago)
Author:
jonsurrell
Message:

Customize: Allow arbitrary custom CSS.

Update custom CSS validation to allow any CSS except STYLE close tags. Previously, some valid CSS would be rejected for containing HTML syntax characters, like this example:

@property --animate {
  syntax: "<custom-ident>"; /* <-- Validation error on `<` */
  inherits: true;
  initial-value: false;
}

Developed in https://github.com/WordPress/wordpress-develop/pull/10667.

Follow-up to [61418], [61486].

Props jonsurrell, westonruter, peterwilsoncc, johnbillion, xknown, sabernhardt, dmsnell, soyebsalar01, dlh.
Fixes #64418.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

    r61486 r61527  
    674674     *              either through a STYLE end tag or a prefix of one which might become a
    675675     *              full end tag when combined with the contents of other styles.
     676     *
     677     * @see WP_Customize_Custom_CSS_Setting::validate()
    676678     *
    677679     * @param string $css CSS to validate.
     
    708710             * when analyzed on their own. The first style was likely the result of
    709711             * improper truncation, while the second is perfectly sound. It was only
    710              * through concatenation that these two scripts combined to form content
     712             * through concatenation that these two styles combined to form content
    711713             * that would have broken out of the containing STYLE element, thus
    712714             * corrupting the page and potentially introducing security issues.
Note: See TracChangeset for help on using the changeset viewer.