From ec78831a814eef6324eb7ef5830625f36117ac9b Mon Sep 17 00:00:00 2001 From: Kalista Payne Date: Mon, 19 May 2025 12:55:07 -0500 Subject: [PATCH] fix(script): don't use extremely costly regex --- scripts/gdpr-delete-users.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/gdpr-delete-users.js b/scripts/gdpr-delete-users.js index fa3541c815..20e44c5f2b 100644 --- a/scripts/gdpr-delete-users.js +++ b/scripts/gdpr-delete-users.js @@ -71,15 +71,14 @@ async function deleteHabiticaData (user, email) { } async function processEmailAddress (email) { - const emailRegex = new RegExp(`^${email}$`, 'i'); const localUsers = await User.find( - { 'auth.local.email': emailRegex }, + { 'auth.local.email': email }, { _id: 1, apiToken: 1, auth: 1 }, ).exec(); const socialUsers = await User.find( { - 'auth.local.email': { $not: emailRegex }, + 'auth.local.email': { $ne: email }, $or: [ { 'auth.facebook.emails.value': email }, { 'auth.google.emails.value': email },