Conversation
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @nvxbug. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
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. |
westonruter
left a comment
There was a problem hiding this comment.
@nvxbug You opened this PR against a closed ticket that landed in WordPress 7.0: https://core.trac.wordpress.org/ticket/64771
Is there a new ticket you meant to target instead? Is this still an issue? If so, make sure there is a new ticket written up that documents it so you can properly attach a PR to it.
|
No new ticket, that one's on me: 64771 is the ticket that introduced the block support and I linked it as the closest match. There's no ticket for this gap yet. It's still an issue on current trunk. On the ticket: I'm not set up with a wordpress.org account to file one from, and since it's a capability gate being bypassed I also wasn't sure whether public Trac or HackerOne is the right place for the writeup. If Trac is fine and you can open one, I'll update the ticket link here and the |
|
If this is a security issue then I'm confused why you're opening a PR publicly unless someone else on the security team told you it was a public hardening. In any case, I encourage you to create a WordPress.org account to create a ticket properly in Trac for this. PRs that aren't attached to Trac tickets in an open milestones are normally not even looked at. |
|
Nobody on the security team told me that, the call was mine. Since it needs |
The custom CSS block support strips
style.cssfrom block attributes oncontent_save_prewhen the saving user lacksedit_css, but block widget content never reaches that filter.WP_Widget_Block::update()and theraw_instancebranch ofWP_Customize_Widgets::sanitize_widget_instance()only runwp_kses_post(), which leaves block comment JSON alone, so a site administrator on multisite (or any administrator underDISALLOW_UNFILTERED_HTML) can save a block widget carrying custom CSS thatdo_blocks()then emits for every visitor.Run the content through
wp_strip_custom_css_from_blocks()in both sanitizers when the current user lacksedit_css, next to the existingunfiltered_htmlcheck. Every save path for block widgets (widgets screen, REST controllers, Customizer changesets) ends in one of these two methods, so the gate holds without each entry point needing its own filter. Includes regression tests for both paths.Trac ticket: https://core.trac.wordpress.org/ticket/64771
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude
Used for: Locating the widget save paths, drafting the patch and the regression tests. The change and tests were reviewed and run locally against the PHPUnit suite in single site and multisite.
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.