Commit 90ea50d0 authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

Revert "[DeviceSync v2] Force enrollment after SyncMetadata 404 errors"

This reverts commit 65e3049c.

Reason for revert: The root cause was found server-side; this workaround is no longer needed.

Original change's description:
> [DeviceSync v2] Force enrollment after SyncMetadata 404 errors
> 
> This is a mitigation put in place to handle 404 errors returned by the
> CryptAuth server during SyncMetadata requests. A 404 error is returned
> when the server cannot find an enrolled device with the same Instance
> ID.
> 
> Theoretically, this should never occur assuming that 1) we never run a
> v2 DeviceSync until the device has successfully enrolled using v2
> Enrollment and 2) the Instance ID does not rotate. Without this
> mitigation, the user will unsuccessfully try to sync until the next
> enrollment, which could be up to 30 days.
> 
> This fix will be removed when the root cause is uncovered.
> 
> Bug: 1092113, b/155642672
> Change-Id: Ibc766ad21d83d1ace26c5e8c6c45f3eed835da74
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2234126
> Reviewed-by: James Vecore <vecore@google.com>
> Commit-Queue: Josh Nohle <nohle@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#776330}

TBR=nohle@chromium.org,vecore@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1092113, b/155642672
Change-Id: I94ac09ca75aba101a800176c644beec4f9ace710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252622Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779951}
parent e1938062
......@@ -294,21 +294,6 @@ void CryptAuthV2DeviceManagerImpl::OnDeviceSyncFinished(
RecordDeviceSyncResult(device_sync_result);
// TODO(https://crbug.com/1092113): This is a workaround for the SyncMetadata
// 404 errors returned by the server when it cannot find an enrolled device
// with the same Instance ID. Theoretically, this should never occur assuming
// that 1) we never run a v2 DeviceSync until the device has successfully
// enrolled using v2 Enrollment and 2) the Instance ID does not rotate.
// Without this mitigation, the user will unsuccessfully try to sync until the
// next enrollment, which could be up to 30 days. Remove this code when the
// root cause is uncovered.
if (device_sync_result.result_code() ==
CryptAuthDeviceSyncResult::ResultCode::
kErrorSyncMetadataApiCallEndpointNotFound) {
scheduler_->RequestEnrollment(cryptauthv2::ClientMetadata::FAILURE_RECOVERY,
base::nullopt /* session_id */);
}
scheduler_->HandleDeviceSyncResult(device_sync_result);
base::Optional<base::TimeDelta> time_to_next_attempt = GetTimeToNextAttempt();
......
......@@ -209,7 +209,6 @@ class DeviceSyncCryptAuthV2DeviceManagerImplTest
}
CryptAuthV2DeviceManager* device_manager() { return device_manager_.get(); }
FakeCryptAuthScheduler* scheduler() { return &fake_scheduler_; }
private:
// Adds the ClientMetadata from the latest DeviceSync request to a list of
......@@ -456,27 +455,6 @@ TEST_F(DeviceSyncCryptAuthV2DeviceManagerImplTest,
TimeoutWaitingForClientAppMetadataAndVerifyResult();
}
// TODO(https://crbug.com/1092113): Remove when bug is resolved.
TEST_F(DeviceSyncCryptAuthV2DeviceManagerImplTest,
ScheduleEnrollmentAfterSyncMetadataEndpointNotFoundError) {
CreateAndStartDeviceManager();
RequestDeviceSyncThroughSchedulerAndVerify(
cryptauthv2::ClientMetadata::PERIODIC, base::nullopt /* session_id */);
SucceedGetClientAppMetadataRequest();
EXPECT_FALSE(scheduler()->IsWaitingForEnrollmentResult());
// Fail SyncMetadata request with 404 error.
FinishDeviceSyncAttemptAndVerifyResult(
0u /* expected_device_sync_instance_index */,
CryptAuthDeviceSyncResult(CryptAuthDeviceSyncResult::ResultCode::
kErrorSyncMetadataApiCallEndpointNotFound,
false /* did_device_registry_change */,
base::nullopt /* client_directive */));
EXPECT_TRUE(scheduler()->IsWaitingForEnrollmentResult());
}
} // namespace device_sync
} // namespace chromeos
......@@ -21,6 +21,7 @@ FakeCryptAuthScheduler::~FakeCryptAuthScheduler() = default;
void FakeCryptAuthScheduler::RequestEnrollment(
const cryptauthv2::ClientMetadata::InvocationReason& invocation_reason,
const base::Optional<std::string>& session_id) {
DCHECK(HasEnrollmentSchedulingStarted());
is_waiting_for_enrollment_result_ = true;
cryptauthv2::ClientMetadata client_metadata;
......@@ -36,6 +37,7 @@ void FakeCryptAuthScheduler::RequestEnrollment(
void FakeCryptAuthScheduler::RequestDeviceSync(
const cryptauthv2::ClientMetadata::InvocationReason& invocation_reason,
const base::Optional<std::string>& session_id) {
DCHECK(HasDeviceSyncSchedulingStarted());
is_waiting_for_device_sync_result_ = true;
cryptauthv2::ClientMetadata client_metadata;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment