Skip to content

Commit

Permalink
Escape the U2F key handle during lookup (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored May 4, 2020
1 parent 9b6e838 commit f8d2fda
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion providers/class.two-factor-fido-u2f.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@ public static function delete_security_key( $user_id, $keyHandle = null ) {
$query = $wpdb->prepare( "SELECT umeta_id FROM $table WHERE meta_key = '%s' AND user_id = %d", self::REGISTERED_KEY_USER_META_KEY, $user_id );

if ( $keyHandle ) {
$query .= $wpdb->prepare( ' AND meta_value LIKE %s', '%:"' . $keyHandle . '";s:%' );
$key_handle_lookup = sprintf( ':"%s";s:', $keyHandle ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase

$query .= $wpdb->prepare(
' AND meta_value LIKE %s',
'%' . $wpdb->esc_like( $key_handle_lookup ) . '%'
);
}

$meta_ids = $wpdb->get_col( $query );
Expand Down

0 comments on commit f8d2fda

Please sign in to comment.