Repository navigation
Conversation
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. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
9b4d4ba to
aebd94d
Compare
…ripts. Several admin scripts pass a link `href` or the URL hash to `$()`, which parses strings that look like HTML as markup. Select through `$( document ).find()` where the value is the whole selector, and escape the value with `$.escapeSelector()` where it is part of a larger selector, so each value is only ever treated as a selector. This follows the same change made to the contextual help tabs in common.js in [64133].
`wp.updates.addAdminNotice()`, `wp.media.transition()` and the attachment details frame's `focusNavButton()` pass a caller-supplied selector to `$()`, which parses a value that looks like HTML as markup. Select through `$( document ).find()` so the value is only ever treated as a selector. This follows [64133] and the admin script changes in the same series.
aebd94d to
2034440
Compare
Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
r64241 removed one case that was hardened here. |
`$( string )` either selects elements or creates elements from HTML, and the string decides which. Several scripts passed values that are not string literals to `$()`. These scripts now use `$( document ).find()`, which only selects. Developed in: #14061 Follow-up to r64133. Props jonsurrell, westonruter. Fixes #66265. git-svn-id: https://develop.svn.wordpress.org/trunk@64498 602fd350-edb4-49c9-b593-d223f7449a82
`$( string )` either selects elements or creates elements from HTML, and the string decides which. Several scripts passed values that are not string literals to `$()`. These scripts now use `$( document ).find()`, which only selects. Developed in: WordPress/wordpress-develop#14061 Follow-up to r64133. Props jonsurrell, westonruter. Fixes #66265. Built from https://develop.svn.wordpress.org/trunk@64498 git-svn-id: http://core.svn.wordpress.org/trunk@63648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Several scripts pass an intended selector variable to
$().$()can be used as a selector or to create elements from HTML. Avoiding$()in favor of$().find()ensures selectors are not incorrectly used as HTML.This is a hardening follow-up to r64133.
Trac ticket: https://core.trac.wordpress.org/ticket/66265
Use of AI Tools
AI assistance: Yes
Tools: Claude Code
Models: Claude Opus 5.5
Used for: Applying the change, checking the touched files for similar selections, running lint, and drafting this description.
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.