Don’t require PROFILES_V2 capability to call setProfile rpc

This commit is contained in:
Chris Eager authored and ravi-signal committed 2026-09-23 13:30:28 -05:00
1 parent 26426dda7f
commit 40889a1337
3 files changed
+1 -29

No files matched your search

@@ -26,7 +26,6 @@ import org.signal.chat.profile.GetAvatarCredentialsResponse;
import org.signal.chat.profile.GetProfileRequest;
import org.signal.chat.profile.GetProfileResponse;
import org.signal.chat.profile.PaymentsForbiddenInRegion;
import org.signal.chat.profile.ProfilesV2CapabilityRequired;
import org.signal.chat.profile.SetProfileRequest;
import org.signal.chat.profile.SetProfileResponse;
import org.signal.chat.profile.SetProfileResult;
@@ -54,7 +53,6 @@ import org.whispersystems.textsecuregcm.s3.PostPolicyGenerator;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountBadge;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.DeviceCapability;
import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager;
import org.whispersystems.textsecuregcm.storage.ProfilesManager;
import org.whispersystems.textsecuregcm.storage.VersionedProfile;
@@ -111,12 +109,6 @@ public class ProfileGrpcService extends SimpleProfileGrpc.ProfileImplBase {
final Account account = accountsManager.getByAccountIdentifier(authenticatedDevice.accountIdentifier())
.orElseThrow(() -> GrpcExceptions.invalidCredentials("invalid credentials"));
if (!account.hasCapability(DeviceCapability.PROFILES_V2)) {
return SetProfileResponse.newBuilder()
.setProfilesV2CapabilityRequired(ProfilesV2CapabilityRequired.getDefaultInstance())
.build();
}
validateRequest(request);
final byte[] expectedCurrentVersion = request.getExpectedCurrentVersion().toByteArray();
@@ -189,11 +189,7 @@ message SetProfileResponse {
// another device on the account may have created a new version the caller does not know about.
errors.FailedPrecondition expected_version_write_conflict = 4 [(tag.reason) = "expected_version_write_conflict"];
// Because this is a temporary field during the migration, it has the highest
// field number without serialization overhead. This is purely aesthetic.
ProfilesV2CapabilityRequired profiles_v2_capability_required = 15 [(tag.reason) = "profiles_v2_capability_required"];
// next: 4
// next: 5
}
}
@@ -362,22 +362,6 @@ public class ProfileGrpcServiceTest extends SimpleBaseGrpcTest<ProfileGrpcServic
verify(accountsManager).updateCurrentProfileVersion(any(), any(), any(), any());
}
@Test
void setProfileWithoutCapability() {
when(account.hasCapability(DeviceCapability.PROFILES_V2)).thenReturn(false);
final SetProfileRequest request = SetProfileRequest.newBuilder()
.setVersion(ByteString.copyFrom(VERSION))
.setData(ByteString.copyFrom(VALID_DATA))
.setExpectedCurrentDataHash(ByteString.copyFrom(TestRandomUtil.nextBytes(32)))
.setV1Request(V1_REQUEST)
.build();
final SetProfileResponse response = authenticatedServiceStub().setProfile(request);
assertTrue(response.hasProfilesV2CapabilityRequired());
}
@Test
void setProfileUnauthenticated() {