Making WordPress.org

Changeset 13442


Ignore:
Timestamp:
04/03/2024 06:52:32 AM (6 months ago)
Author:
dd32
Message:

Theme Directory: Validate that the query input is a string before processing, to reduce the number of pentester warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r12919 r13442  
    846846
    847847    $request = array();
    848     if ( get_query_var( 'browse' ) ) {
     848    if ( get_query_var( 'browse' ) && is_string( get_query_var( 'browse' ) ) ) {
    849849        $request['browse'] = get_query_var( 'browse' );
    850850
     
    853853        }
    854854
    855     } else if ( get_query_var( 'tag' ) ) {
     855    } else if ( get_query_var( 'tag' ) && is_string( get_query_var( 'tag' ) ) ) {
    856856        $request['tag'] = (array) explode( '+', get_query_var( 'tag' ) );
    857857
    858     } else if ( get_query_var( 's' ) ) {
     858    } else if ( get_query_var( 's' ) && is_string( get_query_var( 's' ) ) ) {
    859859        $request['search'] = get_query_var( 's' );
    860860
     
    863863
    864864    } else if ( get_query_var( 'name' ) || get_query_var( 'pagename' ) ) {
    865         $request['theme'] = basename( get_query_var( 'name' ) ?: get_query_var( 'pagename' ) );
     865        $name = get_query_var( 'name' ) ?: get_query_var( 'pagename' );
     866        if ( is_string( $name ) ) {
     867            $request['theme'] = basename( $name );
     868        }
    866869    }
    867870
    868871    if ( get_query_var( 'paged' ) ) {
    869         $request['page'] = (int)get_query_var( 'paged' );
     872        $request['page'] = (int) get_query_var( 'paged' );
    870873    }
    871874
     
    924927function wporg_themes_theme_information( $slug ) {
    925928    return wporg_themes_query_api( 'theme_information', array(
    926         'slug' => $slug,
     929        'slug'   => $slug,
    927930        'fields' => array(
    928931            'description' => true,
Note: See TracChangeset for help on using the changeset viewer.