Repository navigation
Conversation
…llows them. The HTML API based `wp_kses()` stopped sanitizing at the first NOSCRIPT opening tag, so everything after it was dropped from the output. For users without `unfiltered_html`, such as Authors, Contributors and commenters, any post or comment containing a NOSCRIPT fallback lost the rest of its content on save. In 7.1, the NOSCRIPT tags were removed and the following content was kept. Skip NOSCRIPT elements together with their contents, as untrusted input still must not produce them, and continue with the rest of the document. Follow-up to [64233]. See #66208. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
dmsnell
left a comment
There was a problem hiding this comment.
I’ve left a more in-depth comment on the ticket
Some quick notes here: NOSCRIPT doesn’t nest, so there’s never a time we should be tracking depth. It latches instead, like TITLE or TEXTAREA — once we’ve entered into it, we stay in it until the first closing tag.
Please see my linked comment.
The HTML API based
wp_kses()stops sanitizing at the first NOSCRIPT opening tag (breakinsanitize()), so everything after it is dropped. For users withoutunfiltered_html(Authors, Contributors, commenters), a post or comment that contains a NOSCRIPT fallback loses the rest of its content on save:Before <noscript><img src="a.jpg"></noscript> after the noscript.Before <img src="a.jpg"> after the noscript.BeforeThis skips the NOSCRIPT element together with its contents and continues after its closer. Nothing inside a NOSCRIPT is emitted, so untrusted input still cannot produce one, including through a
</noscript>hidden in an attribute value (one of the test cases). An unclosed NOSCRIPT still truncates, like other incomplete input.Trac ticket: https://core.trac.wordpress.org/ticket/66208
Testing
vendor/bin/phpunit --filter test_wp_kses_removes_noscript_and_keeps_following_content: 5 of the 6 cases fail without the patch, all pass with it.vendor/bin/phpunit --group kses(529 tests) and--group html-api(2051 tests) pass.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: finding the issue, drafting the fix and tests, and running them. I reviewed every line and reproduced the output above on 7.1.3 and 7.2-beta1.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code