Store carrier information in verification sessions

This commit is contained in:
Jon Chambers
2026-01-22 11:33:07 -05:00
committed by Jon Chambers
parent 9ffb588c6a
commit 2ed60209b1
4 changed files with 73 additions and 40 deletions

View File

@@ -229,9 +229,16 @@ public class VerificationController {
throw new ServerErrorException(Response.Status.INTERNAL_SERVER_ERROR, e);
}
VerificationSession verificationSession = new VerificationSession(null, new ArrayList<>(),
Collections.emptyList(), null, null, false,
clock.millis(), clock.millis(), registrationServiceSession.expiration());
VerificationSession verificationSession = new VerificationSession(null,
maybeCarrierData.orElse(null),
new ArrayList<>(),
Collections.emptyList(),
null,
null,
false,
clock.millis(),
clock.millis(),
registrationServiceSession.expiration());
verificationSession = handlePushToken(pushTokenAndType, verificationSession);
// unconditionally request a captcha -- it will either be the only requested information, or a fallback
@@ -347,10 +354,16 @@ public class VerificationController {
requestedInformation.add(VerificationSession.Information.PUSH_CHALLENGE);
requestedInformation.addAll(verificationSession.requestedInformation());
verificationSession = new VerificationSession(generatePushChallenge(), requestedInformation,
verificationSession.submittedInformation(), verificationSession.smsSenderOverride(),
verificationSession.voiceSenderOverride(), verificationSession.allowedToRequestCode(),
verificationSession.createdTimestamp(), clock.millis(), verificationSession.remoteExpirationSeconds()
verificationSession = new VerificationSession(generatePushChallenge(),
verificationSession.carrierData(),
requestedInformation,
verificationSession.submittedInformation(),
verificationSession.smsSenderOverride(),
verificationSession.voiceSenderOverride(),
verificationSession.allowedToRequestCode(),
verificationSession.createdTimestamp(),
clock.millis(),
verificationSession.remoteExpirationSeconds()
);
}
@@ -415,9 +428,15 @@ public class VerificationController {
|| requestedInformation.remove(VerificationSession.Information.PUSH_CHALLENGE))
&& requestedInformation.isEmpty();
verificationSession = new VerificationSession(verificationSession.pushChallenge(), requestedInformation,
submittedInformation, verificationSession.smsSenderOverride(), verificationSession.voiceSenderOverride(),
allowedToRequestCode, verificationSession.createdTimestamp(), clock.millis(),
verificationSession = new VerificationSession(verificationSession.pushChallenge(),
verificationSession.carrierData(),
requestedInformation,
submittedInformation,
verificationSession.smsSenderOverride(),
verificationSession.voiceSenderOverride(),
allowedToRequestCode,
verificationSession.createdTimestamp(),
clock.millis(),
verificationSession.remoteExpirationSeconds());
} else if (pushChallengePresent) {
@@ -482,9 +501,15 @@ public class VerificationController {
|| requestedInformation.remove(VerificationSession.Information.CAPTCHA))
&& requestedInformation.isEmpty();
verificationSession = new VerificationSession(verificationSession.pushChallenge(), requestedInformation,
submittedInformation, verificationSession.smsSenderOverride(), verificationSession.voiceSenderOverride(),
allowedToRequestCode, verificationSession.createdTimestamp(), clock.millis(),
verificationSession = new VerificationSession(verificationSession.pushChallenge(),
verificationSession.carrierData(),
requestedInformation,
submittedInformation,
verificationSession.smsSenderOverride(),
verificationSession.voiceSenderOverride(),
allowedToRequestCode,
verificationSession.createdTimestamp(),
clock.millis(),
verificationSession.remoteExpirationSeconds());
} else {
throw new ForbiddenException();

View File

@@ -7,10 +7,10 @@ package org.whispersystems.textsecuregcm.registration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import org.whispersystems.textsecuregcm.storage.SerializedExpireableJsonDynamoStore;
import org.whispersystems.textsecuregcm.telephony.CarrierData;
/**
* Server-internal stored session object. Primarily used by
@@ -19,6 +19,7 @@ import org.whispersystems.textsecuregcm.storage.SerializedExpireableJsonDynamoSt
* {@link org.whispersystems.textsecuregcm.controllers.RegistrationController}.
*
* @param pushChallenge the value of a push challenge sent to a client, after it submitted a push token
* @param carrierData information about the phone number's carrier if available
* @param requestedInformation information requested that a client send to the server
* @param submittedInformation information that a client has submitted and that the server has verified
* @param smsSenderOverride if present, indicates a sender override argument that should be forwarded to the
@@ -36,6 +37,7 @@ import org.whispersystems.textsecuregcm.storage.SerializedExpireableJsonDynamoSt
*/
public record VerificationSession(
@Nullable String pushChallenge,
@Nullable CarrierData carrierData,
List<Information> requestedInformation,
List<Information> submittedInformation,
@Nullable String smsSenderOverride,