Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions TrustKit/Reporting/TSKBackgroundReporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ - (void) pinValidationFailedForHostname:(nonnull NSString *)serverHostname
[NSException raise:@"TSKBackgroundReporter runtime error"
format:@"Report cannot be saved to file: %@", [error description]];
#endif
// In production, if the report could not be written, bail out here. Otherwise we would go on to
// hand a non-existent file to -uploadTaskWithRequest:fromFile:, which throws an uncaught
// NSInvalidArgumentException ("Cannot read file at ...") and crashes the app.
// https://github.com/datatheorem/TrustKit/issues/351
TSKLog(@"Report for %@ could not be saved to file; skipping upload: %@", serverHostname, [error description]);
return;
}
TSKLog(@"Report for %@ created at: %@", serverHostname, [tmpFileURL path]);

Expand Down