Skip to content

Commit f8aca2e

Browse files
authored
$_GET['pagenow'] and $_GET['widget'] unsanitized in dashboard AJAX handler
Both values are read directly without sanitize_key(). While the switch/comparison limits damage, unsanitized superglobal access violates WordPress coding standards unconditionally.
1 parent e12ddb3 commit f8aca2e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,13 @@ 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'] ) : '';
424424
if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) {
425425
set_current_screen( $pagenow );
426426
}
427427

428-
switch ( $_GET['widget'] ) {
428+
$widget = isset( $_GET['widget'] ) ? sanitize_key( $_GET['widget'] ) : '';
429+
switch ( $widget ) {
429430
case 'dashboard_primary':
430431
wp_dashboard_primary();
431432
break;

0 commit comments

Comments
 (0)