Making WordPress.org

Changeset 14366


Ignore:
Timestamp:
01/21/2025 05:33:09 AM (19 months ago)
Author:
dd32
Message:

Plugin Directory: API: Only validate that the locale appears to be a string, rather than a valid locale.

This can cause clients which have invalid locales set on their site to no longer be able to interact with the plugin directory.

See https://core.trac.wordpress.org/ticket/62832.
See [14344].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php

    r14344 r14366  
    330330                }
    331331
    332                 // Validate the locale is in an expected supported format, for all endpoints.
    333                 if (
    334                         ! is_string( $this->locale ) ||
    335                         ! preg_match( '!^[a-z]{2,3}(_([A-Z]{2}))?(_([a-z0-9]+))?$!', $this->locale )
    336                 ) {
     332                /*
     333                 * Validate the locale is in an expected supported format, for all endpoints.
     334                 *
     335                 * Note: Do not validate the locale is valid, as this will cause the endpoints to not
     336                 *       fail for WordPress sites with malformed WPLOCALE constants on their site.
     337                 *       By only validating it's a string, we're ensuring that only non-WordPress clients
     338                 *       should ever hit a block due to invalid passed data.
     339                 */
     340                if ( ! is_string( $this->locale ) ) {
    337341                        return false;
    338342                }
Note: See TracChangeset for help on using the changeset viewer.