Skip to content

Commit 8383688

Browse files
committed
Ajax: Improve sanitization and screen state in dashboard widget updates.
1 parent 4d3b0b9 commit 8383688

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/wp-admin/includes/ajax-actions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,14 @@ function wp_ajax_get_community_events() {
420420
function wp_ajax_dashboard_widgets() {
421421
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
422422

423-
$pagenow = $_GET['pagenow'];
423+
$pagenow = isset( $_GET['pagenow'] ) ? sanitize_key( $_GET['pagenow'] ) : '';
424+
424425
if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) {
425426
set_current_screen( $pagenow );
426427
}
427428

428-
switch ( $_GET['widget'] ) {
429+
$widget = isset( $_GET['widget'] ) ? sanitize_key( $_GET['widget'] ) : '';
430+
switch ( $widget ) {
429431
case 'dashboard_primary':
430432
wp_dashboard_primary();
431433
break;

0 commit comments

Comments
 (0)