From a5f2f7f3e55f8641e2bc3969f671729edc1737de Mon Sep 17 00:00:00 2001 From: Ravi Khadiwala Date: Mon, 24 Aug 2026 07:14:30 -0500 Subject: [PATCH] Move number rate-limiting after verification --- .../textsecuregcm/controllers/RegistrationController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java index 378ee0fa9..d7b9710c6 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java @@ -226,8 +226,6 @@ public class RegistrationController { throw new WebApplicationException("PNI keys and registration ID must be provided", 422); } - rateLimiters.getRegistrationLimiter().validate(number); - final PhoneVerificationRequest.VerificationType verificationType; try { verificationType = phoneVerificationTokenManager.verify( @@ -247,6 +245,8 @@ public class RegistrationController { throw new ForbiddenException("recovery password could not be verified"); } + rateLimiters.getRegistrationLimiter().validate(number); + // There can be at most one existing account for a set of numbers in the same equivalence class, so it's sufficient // to find the first one. final Optional existingAccount = Util.getAlternateForms(number)