fix(cron): prevent telemetry ping when telemetry is disabled (#3313)

this updates the cron to avoid running the telemetry ping when
telemetry is disabled so that personally identifiable information
is not sent off to other parties (an IP address, an installation ID)
This commit is contained in:
James Ward
2026-03-12 20:43:28 -06:00
committed by GitHub
parent 9e1ff527e8
commit cac557b74e
2 changed files with 30 additions and 9 deletions
@@ -84,7 +84,19 @@ class CronServiceTest {
}
@Test
void sendPing_postSuccess_savesSettings() {
void sendPing_telemetryDisabled_doesNotSend() {
AppSettings settings = mock(AppSettings.class);
when(appSettingService.getAppSettings()).thenReturn(settings);
when(settings.isTelemetryEnabled()).thenReturn(false);
cronService.sendPing();
verifyNoInteractions(restClient);
}
@Test
void sendPing_telemetryEnabled_postSuccess_savesSettings() {
AppSettings settings = mock(AppSettings.class);
when(appSettingService.getAppSettings()).thenReturn(settings);
when(settings.isTelemetryEnabled()).thenReturn(true);
when(appProperties.getTelemetry().getBaseUrl()).thenReturn("http://telemetry");
InstallationPing ping = InstallationPing.builder().appVersion("1.0.0").build();
when(telemetryService.getInstallationPing()).thenReturn(ping);
@@ -99,7 +111,10 @@ class CronServiceTest {
}
@Test
void sendPing_postFails_doesNotSaveSettings() {
void sendPing_telemetryEnabled_postFails_doesNotSaveSettings() {
AppSettings settings = mock(AppSettings.class);
when(appSettingService.getAppSettings()).thenReturn(settings);
when(settings.isTelemetryEnabled()).thenReturn(true);
when(appProperties.getTelemetry().getBaseUrl()).thenReturn("http://telemetry");
InstallationPing ping = InstallationPing.builder().appVersion("1.0.0").build();
when(telemetryService.getInstallationPing()).thenReturn(ping);