Skip to content

Commit eec75a6

Browse files
fix: Remove boot_time from crash reports (#3916)
This is a follow up on #3912.
1 parent a40ffe8 commit eec75a6

File tree

7 files changed

+27
-4
lines changed

7 files changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Fixes
66

7-
- Don't transmit device boot time in envelopes enriched with crash data (#3912)
7+
- Don't transmit device boot time in envelopes enriched with crash data (#3912, #3916)
88

99
### Improvements
1010

Sources/Sentry/include/SentryAppState.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ SENTRY_NO_INIT
3131
* The boot time of the system rounded down to seconds. As the precision of the serialization is
3232
* only milliseconds and a precision of seconds is enough we round down to seconds. With this we
3333
* avoid getting different dates before and after serialization.
34+
*
35+
* @warning We must not send this information off device because Apple forbids that.
36+
* We are allowed send the amount of time that has elapsed between events that occurred within the
37+
* app though. For more information see
38+
* https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394.
3439
*/
3540
@property (readonly, nonatomic, copy) NSDate *systemBootTimestamp;
3641

Sources/Sentry/include/SentrySysctl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ NS_ASSUME_NONNULL_BEGIN
99

1010
/**
1111
* Returns the time the system was booted with a precision of microseconds.
12+
*
13+
* @warning We must not send this information off device because Apple forbids that.
14+
* We are allowed send the amount of time that has elapsed between events that occurred within the
15+
* app though. For more information see
16+
* https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394.
1217
*/
1318
@property (readonly) NSDate *systemBootTimestamp;
1419

Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ typedef struct SentryCrash_MonitorContext {
179179
const char *kernelVersion;
180180
const char *osVersion;
181181
bool isJailbroken;
182+
/**
183+
* @warning We must not send this information off device because Apple forbids that.
184+
* We are allowed send the amount of time that has elapsed between events that occurred
185+
* within the app though. For more information see
186+
* https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394.
187+
*/
182188
const char *bootTime;
183189
const char *appStartTime;
184190
const char *executablePath;

Sources/SentryCrash/Recording/SentryCrashReport.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,8 +1550,6 @@ writeSystemInfo(const SentryCrashReportWriter *const writer, const char *const k
15501550
writer, SentryCrashField_OSVersion, monitorContext->System.osVersion);
15511551
writer->addBooleanElement(
15521552
writer, SentryCrashField_Jailbroken, monitorContext->System.isJailbroken);
1553-
writer->addStringElement(
1554-
writer, SentryCrashField_BootTime, monitorContext->System.bootTime);
15551553
writer->addStringElement(
15561554
writer, SentryCrashField_AppStartTime, monitorContext->System.appStartTime);
15571555
writer->addStringElement(

Sources/SentryCrash/Recording/SentryCrashReportFields.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@
183183
#pragma mark System
184184
#define SentryCrashField_AppStartTime "app_start_time"
185185
#define SentryCrashField_AppUUID "app_uuid"
186-
#define SentryCrashField_BootTime "boot_time"
187186
#define SentryCrashField_BundleID "CFBundleIdentifier"
188187
#define SentryCrashField_BundleName "CFBundleName"
189188
#define SentryCrashField_BundleShortVersion "CFBundleShortVersionString"

Tests/SentryTests/Integrations/SentryCrash/SentryCrashReportTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ class SentryCrashReportTests: XCTestCase {
108108
}
109109
}
110110

111+
func testCrashReportDoesNotContainBootTime() throws {
112+
writeCrashReport()
113+
114+
let crashReportContents = FileManager.default.contents(atPath: fixture.reportPath) ?? Data()
115+
116+
let crashReportContentsAsString = String(data: crashReportContents, encoding: .ascii)
117+
118+
expect(crashReportContentsAsString).toNot(contain("boot_time"), description: "The crash report must not contain boot_time because Apple forbids sending this information off device see: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394.")
119+
}
120+
111121
private func writeCrashReport() {
112122
var monitorContext = SentryCrash_MonitorContext()
113123

0 commit comments

Comments
 (0)