Sanitize 'update_plugins' and 'update_themes' transients. - #13282
Sanitize 'update_plugins' and 'update_themes' transients.#13282siliconforks wants to merge 2 commits into
Conversation
|
Some notes for people testing and/or reviewing this PR... To run the test suite with the new test, I ran the following command: Then I edited my to this: Then I ran the test suite again. This works (and it is similar to the way |
WordPress stores plugin and theme update information in the 'update_plugins' and 'update_themes' transients respectively. If the `wp_options` table uses a legacy character set (e.g., `utf8mb3`), then it is possible that plugin or theme update information may contain characters which cannot be represented in the database. If that happens, then the transients cannot be saved to the database, which will prevent updates from occurring. To avoid this, we need to call `$wpdb->strip_invalid_text_for_column()` on the transients before they are serialized and stored in the database.
3c7ce8a to
a1035f6
Compare
|
|
||
| case '_site_transient_update_plugins': | ||
| case '_site_transient_update_themes': | ||
| $value = map_deep( |
There was a problem hiding this comment.
Any risk in touching every field? which field have actual user controlled data, can/should we limit to just those?
There was a problem hiding this comment.
We could skip some fields. But one problem is that plugins can use the Update URI header field and the update_plugins_{$hostname} filter to basically put whatever they want in any field. So even if there are some fields that will never contain anything but ASCII for plugins hosted in the wordpress.org plugin directory, there may be other third-party plugins which get their update information from some external server, and that information could basically contain anything anywhere.
|
Overall I like this approach better and while it doesn't exclude landing the error handling from #12596 I'm not sure we need that PR unless there is an actual route to triggering an error. |
|
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. |
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. |
WordPress stores plugin and theme update information in the 'update_plugins' and 'update_themes' transients respectively.
If the
wp_optionstable uses a legacy character set (e.g.,utf8mb3), then it is possible that plugin or theme update information may contain characters which cannot be represented in the database.If that happens, then the transients cannot be saved to the database, which will prevent updates from occurring.
To avoid this, we need to call
$wpdb->strip_invalid_text_for_column()on the transients before they are serialized and stored in the database.Trac ticket: https://core.trac.wordpress.org/ticket/64550
Use of AI Tools
None
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.