Make WordPress Core


Ignore:
Timestamp:
09/04/2025 02:38:15 PM (2 months ago)
Author:
jonsurrell
Message:

HTML API: Prevent adding dangerous double-escape SCRIPT contents.

Prevent WP_Tag_Processor::set_modifiable_text() from allowing SCRIPT contents with "<script" like it does with "</script". Either of these sequences may affect the script element's close.

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

Props jonsurrell, westonruter, dmsnell.
See #63738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php

    r59250 r60706  
    491491            'SCRIPT with </script>'            => array( '<script>Replace me</script>', 'Just a </script>' ),
    492492            'SCRIPT with </script attributes>' => array( '<script>Replace me</script>', 'before</script id=sneak>after' ),
     493            'SCRIPT with "<script " opener'    => array( '<script>Replace me</script>', '<!--<script ' ),
    493494        );
    494495    }
Note: See TracChangeset for help on using the changeset viewer.