Make WordPress Core


Ignore:
Timestamp:
09/19/2017 01:48:11 PM (9 years ago)
Author:
johnbillion
Message:

General: Add missing URL-encoding and add extra hardening to plugin and template names when they're displayed in the admin area.

Merges [41434] with changes to the 3.8 branch.

See #13377

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

  • branches/3.8/src/wp-admin/plugin-editor.php

    r26518 r41452  
    8787
    8888        if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
    89             activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
    90 
    91         wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
     89            activate_plugin($file, "plugin-editor.php?file=" . urlencode( $file ) . "&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
     90
     91        wp_redirect( self_admin_url("plugin-editor.php?file=" . urlencode( $file ) . "&a=te&scrollto=$scrollto") );
    9292        exit;
    9393    }
     
    175175    if ( is_plugin_active($plugin) ) {
    176176        if ( is_writeable($real_file) )
    177             echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
     177            echo sprintf(__('Editing <strong>%s</strong> (active)'), esc_html( $file ) );
    178178        else
    179             echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
     179            echo sprintf(__('Browsing <strong>%s</strong> (active)'), esc_html( $file ) );
    180180    } else {
    181181        if ( is_writeable($real_file) )
    182             echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
     182            echo sprintf(__('Editing <strong>%s</strong> (inactive)'), esc_html( $file ) );
    183183        else
    184             echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
     184            echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), esc_html( $file ) );
    185185    }
    186186    ?></big>
     
    226226    }
    227227?>
    228         <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
     228        <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo esc_html( $plugin_file ); ?></a></li>
    229229<?php endforeach; ?>
    230230    </ul>
Note: See TracChangeset for help on using the changeset viewer.