Skip to content

Commit 2d13623

Browse files
authored
Add nonce verification and sanitize $_REQUEST/$_GET values. (#115)
Signed-off-by: Colin Stewart <[email protected]>
1 parent 90222a5 commit 2d13623

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

includes/class-themes-screens.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ public function admin_enqueue_scripts( $hook ) {
9090
* @return void
9191
*/
9292
public function redirect_to_theme_install() {
93-
$browse = isset( $_GET['browse'] ) ? wp_unslash( $_GET['browse'] ) : '';
93+
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : false;
94+
if ( $nonce && ! wp_verify_nonce( $nonce, 'query-themes' ) ) {
95+
return;
96+
}
97+
98+
$browse = isset( $_GET['browse'] ) ? sanitize_text_field( wp_unslash( $_GET['browse'] ) ) : '';
9499
if ( ! in_array( $browse, $this->unsupported_filters, true ) ) {
95100
return;
96101
}

0 commit comments

Comments
 (0)