Skip to content

Commit

Permalink
Add nonce verification and sanitize $_REQUEST/$_GET values. (#115)
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Stewart <[email protected]>
  • Loading branch information
costdev authored Nov 4, 2024
1 parent 90222a5 commit 2d13623
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/class-themes-screens.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public function admin_enqueue_scripts( $hook ) {
* @return void
*/
public function redirect_to_theme_install() {
$browse = isset( $_GET['browse'] ) ? wp_unslash( $_GET['browse'] ) : '';
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : false;
if ( $nonce && ! wp_verify_nonce( $nonce, 'query-themes' ) ) {
return;
}

$browse = isset( $_GET['browse'] ) ? sanitize_text_field( wp_unslash( $_GET['browse'] ) ) : '';
if ( ! in_array( $browse, $this->unsupported_filters, true ) ) {
return;
}
Expand Down

0 comments on commit 2d13623

Please sign in to comment.