Make WordPress Core


Ignore:
Timestamp:
06/21/2013 05:54:40 AM (12 years ago)
Author:
nacin
Message:

More robust escaping in the plugin/theme upgrader.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/update.php

    r23554 r24474  
    5858
    5959        $nonce = 'upgrade-plugin_' . $plugin;
    60         $url = 'update.php?action=upgrade-plugin&plugin=' . $plugin;
     60        $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
    6161
    6262        $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
     
    7171        check_admin_referer('activate-plugin_' . $plugin);
    7272        if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
    73             wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) );
     73            wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
    7474            activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
    75             wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) );
     75            wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
    7676            die();
    7777        }
     
    108108        $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
    109109        $nonce = 'install-plugin_' . $plugin;
    110         $url = 'update.php?action=install-plugin&plugin=' . $plugin;
     110        $url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
    111111        if ( isset($_GET['from']) )
    112112            $url .= '&from=' . urlencode(stripslashes($_GET['from']));
     
    133133        require_once(ABSPATH . 'wp-admin/admin-header.php');
    134134
    135         $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
     135        $title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
    136136        $nonce = 'plugin-upload';
    137137        $url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin');
     
    161161
    162162        $nonce = 'upgrade-theme_' . $theme;
    163         $url = 'update.php?action=upgrade-theme&theme=' . $theme;
     163        $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
    164164
    165165        $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
     
    214214        $title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
    215215        $nonce = 'install-theme_' . $theme;
    216         $url = 'update.php?action=install-theme&theme=' . $theme;
     216        $url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
    217217        $type = 'web'; //Install theme type, From Web or an Upload.
    218218
     
    239239        require_once(ABSPATH . 'wp-admin/admin-header.php');
    240240
    241         $title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
     241        $title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
    242242        $nonce = 'theme-upload';
    243243        $url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme');
Note: See TracChangeset for help on using the changeset viewer.