From cf5ca7e1998cae49b338c192aeb534e03ca2c44e Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Tue, 9 Nov 2021 14:19:49 -0800 Subject: [PATCH 01/13] Handle macOS 12 crashes. --- DuckDuckGo.xcodeproj/project.pbxproj | 24 ++ .../Crash Reports/Model/CrashReport.swift | 51 +++- .../Model/CrashReportReader.swift | 13 +- .../Crash Reports/CrashReportTests.swift | 48 ++++ .../DuckDuckGo-ExampleCrash.ips | 255 ++++++++++++++++++ 5 files changed, 386 insertions(+), 5 deletions(-) create mode 100644 Unit Tests/Crash Reports/CrashReportTests.swift create mode 100644 Unit Tests/Crash Reports/Example Crash Reports/DuckDuckGo-ExampleCrash.ips diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index bab631968d..8e7e562da3 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -205,6 +205,8 @@ 4BB99D1026FE1A84001E4761 /* FirefoxBookmarksReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB99D0D26FE1A83001E4761 /* FirefoxBookmarksReaderTests.swift */; }; 4BB99D1126FE1A84001E4761 /* SafariBookmarksReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB99D0E26FE1A84001E4761 /* SafariBookmarksReaderTests.swift */; }; 4BB99D1326FE1A94001E4761 /* places.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 4BB99D1226FE1A94001E4761 /* places.sqlite */; }; + 4BD66A52273B1C4F003E4A9B /* CrashReportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD66A51273B1C4F003E4A9B /* CrashReportTests.swift */; }; + 4BD66A55273B1C66003E4A9B /* DuckDuckGo-ExampleCrash.ips in Resources */ = {isa = PBXBuildFile; fileRef = 4BD66A54273B1C66003E4A9B /* DuckDuckGo-ExampleCrash.ips */; }; 4BE0DF06267819A1006337B7 /* NSStoryboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0DF0426781961006337B7 /* NSStoryboardExtension.swift */; }; 4BE65474271FCD40008D1D63 /* PasswordManagementIdentityItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6546E271FCD40008D1D63 /* PasswordManagementIdentityItemView.swift */; }; 4BE65476271FCD41008D1D63 /* PasswordManagementCreditCardItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE65470271FCD40008D1D63 /* PasswordManagementCreditCardItemView.swift */; }; @@ -827,6 +829,8 @@ 4BB99D0D26FE1A83001E4761 /* FirefoxBookmarksReaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirefoxBookmarksReaderTests.swift; sourceTree = ""; }; 4BB99D0E26FE1A84001E4761 /* SafariBookmarksReaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafariBookmarksReaderTests.swift; sourceTree = ""; }; 4BB99D1226FE1A94001E4761 /* places.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = places.sqlite; sourceTree = ""; }; + 4BD66A51273B1C4F003E4A9B /* CrashReportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportTests.swift; sourceTree = ""; }; + 4BD66A54273B1C66003E4A9B /* DuckDuckGo-ExampleCrash.ips */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "DuckDuckGo-ExampleCrash.ips"; sourceTree = ""; }; 4BE0DF0426781961006337B7 /* NSStoryboardExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSStoryboardExtension.swift; sourceTree = ""; }; 4BE6546E271FCD40008D1D63 /* PasswordManagementIdentityItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordManagementIdentityItemView.swift; sourceTree = ""; }; 4BE65470271FCD40008D1D63 /* PasswordManagementCreditCardItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordManagementCreditCardItemView.swift; sourceTree = ""; }; @@ -1805,6 +1809,23 @@ path = "Test Safari Data"; sourceTree = ""; }; + 4BD66A50273B18D5003E4A9B /* Crash Reports */ = { + isa = PBXGroup; + children = ( + 4BD66A51273B1C4F003E4A9B /* CrashReportTests.swift */, + 4BD66A53273B1C53003E4A9B /* Example Crash Reports */, + ); + path = "Crash Reports"; + sourceTree = ""; + }; + 4BD66A53273B1C53003E4A9B /* Example Crash Reports */ = { + isa = PBXGroup; + children = ( + 4BD66A54273B1C66003E4A9B /* DuckDuckGo-ExampleCrash.ips */, + ); + path = "Example Crash Reports"; + sourceTree = ""; + }; 7B4CE8DB26F02108009134B1 /* UI Tests */ = { isa = PBXGroup; children = ( @@ -2198,6 +2219,7 @@ 85F69B3A25EDE7F800978E59 /* Common */, 85AC3B1525D9BBFA00C7D2AA /* Configuration */, 4B82E9B725B6A04B00656FE7 /* ContentBlocker */, + 4BD66A50273B18D5003E4A9B /* Crash Reports */, 4B723DFE26B0003E00E14D75 /* Data Import */, 4B723E0226B0003E00E14D75 /* Data Export */, 8553FF50257523630029327F /* FileDownload */, @@ -3477,6 +3499,7 @@ 4B8AC94126B49BEE00879451 /* key4.db in Resources */, B67C6C422654BF49006C872E /* DuckDuckGo-Symbol.jpg in Resources */, B69B50552726CD8100758A2B /* invalid.json in Resources */, + 4BD66A55273B1C66003E4A9B /* DuckDuckGo-ExampleCrash.ips in Resources */, 4B8AC94026B49BEE00879451 /* logins.json in Resources */, 4B59024A26B38B0B00489384 /* Login Data in Resources */, 4BB46EA226B8954500222970 /* logins-encrypted.json in Resources */, @@ -4078,6 +4101,7 @@ AAEC74B22642C57200C2EFBC /* HistoryCoordinatingMock.swift in Sources */, AAEC74B62642CC6A00C2EFBC /* HistoryStoringMock.swift in Sources */, AA652CB125DD825B009059CC /* LocalBookmarkStoreTests.swift in Sources */, + 4BD66A52273B1C4F003E4A9B /* CrashReportTests.swift in Sources */, B630794226731F5400DCEE41 /* WKDownloadMock.swift in Sources */, B6C0B24626E9CB190031CB7F /* RunLoopExtensionTests.swift in Sources */, B693956326F1C2A40015B914 /* FileDownloadManagerMock.swift in Sources */, diff --git a/DuckDuckGo/Crash Reports/Model/CrashReport.swift b/DuckDuckGo/Crash Reports/Model/CrashReport.swift index c28081df26..4e86a90e3c 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReport.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReport.swift @@ -20,7 +20,19 @@ import Foundation #if OUT_OF_APPSTORE -struct CrashReport { +protocol CrashReport { + + static var fileExtension: String { get } + + var url: URL { get } + var content: String? { get } + var contentData: Data? { get } + +} + +struct LegacyCrashReport: CrashReport { + + static let fileExtension = "crash" static let headerItemsToFilter = [ "Anonymous UUID:", @@ -33,8 +45,8 @@ struct CrashReport { try? String(contentsOf: url) .components(separatedBy: "\n") .filter({ line in - for headerItemToFilder in Self.headerItemsToFilter { - if line.hasPrefix(headerItemToFilder) { return false } + for headerItemToFilter in Self.headerItemsToFilter { + if line.hasPrefix(headerItemToFilter) { return false } } return true }) @@ -47,4 +59,37 @@ struct CrashReport { } +struct JSONCrashReport: CrashReport { + + static let fileExtension = "ips" + + static let headerItemsToFilter = [ + "sleepWakeUUID" + ] + + let url: URL + + var content: String? { + guard var fileContents = try? String(contentsOf: url) else { + return nil + } + + for itemToFilter in Self.headerItemsToFilter { + let patternToReplace = "\"\(itemToFilter)\"\\s*:\\s*\".*\"" + let redactedKeyValuePair = "\"\(itemToFilter)\":\"\"" + + fileContents = fileContents.replacingOccurrences(of: patternToReplace, + with: redactedKeyValuePair, + options: .regularExpression) + } + + return fileContents + } + + var contentData: Data? { + content?.data(using: .utf8) + } + +} + #endif diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift b/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift index f811581d43..d9ddc8b719 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift @@ -39,11 +39,12 @@ final class CrashReportReader { .filter({ isCrashReportPath($0) && belongsToThisApp($0) && isFile(at: $0, newerThan: lastCheckDate) }) - .map({ CrashReport(url: $0) }) + .compactMap(crashReport(from:)) } private func isCrashReportPath(_ path: URL) -> Bool { - return path.pathExtension == "crash" + let validExtensions = ["crash", "ips"] + return validExtensions.contains(path.pathExtension) } private func belongsToThisApp(_ path: URL) -> Bool { @@ -58,6 +59,14 @@ final class CrashReportReader { return creationDate > lastCheckDate && creationDate < Date() } + + private func crashReport(from url: URL) -> CrashReport? { + switch url.pathExtension { + case LegacyCrashReport.fileExtension: return LegacyCrashReport(url: url) + case JSONCrashReport.fileExtension: return JSONCrashReport(url: url) + default: return nil + } + } } diff --git a/Unit Tests/Crash Reports/CrashReportTests.swift b/Unit Tests/Crash Reports/CrashReportTests.swift new file mode 100644 index 0000000000..215e84f74c --- /dev/null +++ b/Unit Tests/Crash Reports/CrashReportTests.swift @@ -0,0 +1,48 @@ +// +// CrashReportTests.swift +// +// Copyright © 2021 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import XCTest +@testable import DuckDuckGo_Privacy_Browser + +class CrashReportTests: XCTestCase { + + func testWhenParsingIPSCrashReports_ThenCrashReportDataDoesNotIncludeIdentifyingInformation() { + let bundle = Bundle(for: CrashReportTests.self) + let url = bundle.resourceURL!.appendingPathComponent("DuckDuckGo-ExampleCrash.ips") + + let report = JSONCrashReport(url: url) + + XCTAssertNotNil(report.content) + XCTAssertNotNil(report.contentData) + + // Verify that the content includes the slice ID + XCTAssertTrue(report.content!.contains("7fc6ff2c-a85d-3116-96d9-9368ec955ba1")) + + // Verify that the content does not include the sleepWakeUUID anywhere in the report + XCTAssertFalse(report.content!.contains("2384290E-F858-4024-9488-11D3FF94B4DD")) + + // Verify that the sleepWakeUUID is definitely empty + XCTAssert(report.content!.contains(#"sleepWakeUUID":""#)) + } + + private func ipsCrashURL() -> URL { + let bundle = Bundle(for: CrashReportTests.self) + return bundle.resourceURL!.appendingPathComponent("DuckDuckGo-ExampleCrash.ips") + } + +} diff --git a/Unit Tests/Crash Reports/Example Crash Reports/DuckDuckGo-ExampleCrash.ips b/Unit Tests/Crash Reports/Example Crash Reports/DuckDuckGo-ExampleCrash.ips new file mode 100644 index 0000000000..9bf7aa60e3 --- /dev/null +++ b/Unit Tests/Crash Reports/Example Crash Reports/DuckDuckGo-ExampleCrash.ips @@ -0,0 +1,255 @@ +{"app_name":"DuckDuckGo","timestamp":"2021-11-09 11:51:26.00 -0800","app_version":"0.17.3","slice_uuid":"7fc6ff2c-a85d-3116-96d9-9368ec955ba1","build_version":"0.17.3","platform":1,"bundleID":"com.duckduckgo.macos.browser","share_with_app_devs":1,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.0.1 (21A559)","incident_id":"F3F13C9E-2929-4561-BDFB-3921284335D4","name":"DuckDuckGo"} +{ + "uptime" : 70000, + "procLaunch" : "2021-11-09 11:51:11.9502 -0800", + "procRole" : "Foreground", + "version" : 2, + "userID" : 501, + "deployVersion" : 210, + "modelCode" : "MacBookPro18,1", + "procStartAbsTime" : 1689148687473, + "coalitionID" : 14326, + "osVersion" : { + "train" : "macOS 12.0.1", + "build" : "21A559", + "releaseType" : "User" + }, + "captureTime" : "2021-11-09 11:51:18.6343 -0800", + "incident" : "F3F13C9E-2929-4561-BDFB-3921284335D4", + "bug_type" : "309", + "pid" : 58349, + "procExitAbsTime" : 1689308821853, + "translated" : false, + "cpuType" : "ARM-64", + "procName" : "DuckDuckGo", + "procPath" : "\/Users\/USER\/Library\/Developer\/Xcode\/DerivedData\/DuckDuckGo-btirywidbxinwsbhskhemidiqvyo\/Build\/Products\/Release\/DuckDuckGo.app\/Contents\/MacOS\/DuckDuckGo", + "bundleInfo" : {"CFBundleShortVersionString":"0.17.3","CFBundleVersion":"0.17.3","CFBundleIdentifier":"com.duckduckgo.macos.browser"}, + "storeInfo" : {"deviceIdentifierForVendor":"483B097A-A969-596F-9F2A-357347BB1DEC","thirdParty":true}, + "parentProc" : "launchd", + "parentPid" : 1, + "coalitionName" : "com.duckduckgo.macos.browser", + "crashReporterKey" : "92E4AF6A-7D61-7C5E-EFBF-FF5B870AD3D4", + "wakeTime" : 3259, + "sleepWakeUUID" : "2384290E-F858-4024-9488-11D3FF94B4DD", + "sip" : "enabled", + "isCorpse" : 1, + "exception" : {"codes":"0x0000000000000001, 0x00000001a6ee08dc","rawCodes":[1,7095584988],"type":"EXC_BREAKPOINT","signal":"SIGTRAP"}, + "termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Trace\/BPT trap: 5","byProc":"exc handler","byPid":58349}, + "asi" : {"AppKit":["Performing @selector(triggerFatalError:) from sender NSMenuItem 0x108716f10"],"libswiftCore.dylib":["DuckDuckGo_Privacy_Browser\/MainMenuActions.swift:437: Fatal error: Fatal error triggered from the Debug menu"]}, + "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":2166,"task_for_pid":38},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, + "faultingThread" : 0, + "threads" : [{"triggered":true,"id":1134772,"threadState":{"x":[{"value":9223372041197438704},{"value":7099567024,"symbolLocation":200,"symbol":"_swift_stdlib_reportFatalErrorInFile"},{"value":4390977024,"symbolLocation":0,"symbol":"__tsan::allocator_placeholder"},{"value":4844853248},{"value":1},{"value":1},{"value":117},{"value":62},{"value":105553133043736},{"value":105553116266496},{"value":4611686018427387904},{"value":524},{"value":8},{"value":0},{"value":16},{"value":17611565457792},{"value":13138908936},{"value":4377019776,"symbolLocation":0,"symbol":"_main_thread"},{"value":5297371456},{"value":4342621072},{"value":9223372041197438704},{"value":2},{"value":11},{"value":48},{"value":437},{"value":4342662864},{"value":14987979559889010729},{"value":0},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":7095584988},"cpsr":{"value":0},"fp":{"value":6134868080},"sp":{"value":6134867872},"esr":{"value":4060086273,"description":"(Breakpoint) brk 1"},"pc":{"value":7095584988,"matchesCrashFrame":1},"far":{"value":17625675442816}},"queue":"com.apple.main-thread","frames":[{"imageOffset":239836,"symbol":"_assertionFailure(_:_:file:line:flags:)","symbolLocation":308,"imageIndex":0},{"imageOffset":239836,"symbol":"_assertionFailure(_:_:file:line:flags:)","symbolLocation":308,"imageIndex":0},{"symbol":"MainViewController.triggerFatalError(_:)","inline":true,"imageIndex":1,"imageOffset":2068696,"symbolLocation":112,"sourceLine":437,"sourceFile":"MainMenuActions.swift"},{"imageOffset":2068696,"sourceLine":436,"sourceFile":"","symbol":"@objc MainViewController.triggerFatalError(_:)","imageIndex":1,"symbolLocation":220},{"imageOffset":2383908,"symbol":"-[NSApplication(NSResponder) sendAction:to:from:]","symbolLocation":456,"imageIndex":2},{"imageOffset":3390540,"symbol":"-[NSMenuItem _corePerformAction]","symbolLocation":444,"imageIndex":2},{"imageOffset":3389760,"symbol":"-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:]","symbolLocation":100,"imageIndex":2},{"imageOffset":3687064,"symbol":"-[NSMenu performActionForItemAtIndex:]","symbolLocation":196,"imageIndex":2},{"imageOffset":3686844,"symbol":"-[NSMenu _internalPerformActionForItemAtIndex:]","symbolLocation":100,"imageIndex":2},{"imageOffset":3686592,"symbol":"-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:]","symbolLocation":364,"imageIndex":2},{"imageOffset":3274808,"symbol":"NSSLMMenuEventHandler","symbolLocation":728,"imageIndex":2},{"imageOffset":36404,"symbol":"DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*)","symbolLocation":1116,"imageIndex":3},{"imageOffset":33440,"symbol":"SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*)","symbolLocation":356,"imageIndex":3},{"imageOffset":123948,"symbol":"SendEventToEventTarget","symbolLocation":40,"imageIndex":3},{"imageOffset":525168,"symbol":"SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**)","symbolLocation":420,"imageIndex":3},{"imageOffset":676132,"symbol":"SendMenuCommandWithContextAndModifiers","symbolLocation":56,"imageIndex":3},{"imageOffset":676020,"symbol":"SendMenuItemSelectedEvent","symbolLocation":356,"imageIndex":3},{"imageOffset":675548,"symbol":"FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*)","symbolLocation":100,"imageIndex":3},{"imageOffset":678048,"symbol":"MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*)","symbolLocation":572,"imageIndex":3},{"imageOffset":677300,"symbol":"_HandleMenuSelection2","symbolLocation":416,"imageIndex":3},{"imageOffset":1962096,"symbol":"_NSHandleCarbonMenuEvent","symbolLocation":288,"imageIndex":2},{"imageOffset":1961564,"symbol":"_DPSEventHandledByCarbon","symbolLocation":68,"imageIndex":2},{"imageOffset":265104,"symbol":"-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]","symbolLocation":3380,"imageIndex":2},{"imageOffset":205744,"symbol":"-[NSApplication run]","symbolLocation":596,"imageIndex":2},{"imageOffset":14980,"symbol":"NSApplicationMain","symbolLocation":1064,"imageIndex":2},{"imageOffset":73832,"sourceLine":30,"sourceFile":"AppDelegate.swift","symbol":"main","imageIndex":1,"symbolLocation":40},{"imageOffset":20724,"symbol":"start","symbolLocation":520,"imageIndex":4}]},{"id":1134791,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134792,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134793,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134808,"queue":"com.apple.root.background-qos","frames":[{"imageOffset":11496,"symbol":"pthread_self","symbolLocation":60,"imageIndex":5},{"imageOffset":488988,"symbol":"__tsan::cur_thread()","symbolLocation":32,"imageIndex":6},{"imageOffset":332244,"symbol":"__tsan_atomic64_fetch_add","symbolLocation":48,"imageIndex":6},{"symbol":"void std::__1::allocator::construct(char*, char&&)","inline":true,"imageIndex":1,"imageOffset":62468,"symbolLocation":20,"sourceLine":915,"sourceFile":"memory"},{"symbol":"void std::__1::allocator_traits >::construct(std::__1::allocator&, char*, char&&)","inline":true,"imageIndex":1,"imageOffset":62468,"symbolLocation":56,"sourceLine":288,"sourceFile":"allocator_traits.h"},{"symbol":"void std::__1::vector >::__construct_one_at_end(char&&)","inline":true,"imageIndex":1,"imageOffset":62468,"symbolLocation":204,"sourceLine":926,"sourceFile":"vector"},{"symbol":"void std::__1::vector >::emplace_back(char&&)","inline":true,"imageIndex":1,"imageOffset":62468,"symbolLocation":352,"sourceLine":1684,"sourceFile":"vector"},{"symbol":"void std::__1::vector >::__emplace_back(char&&)","inline":true,"imageIndex":1,"imageOffset":62468,"symbolLocation":388,"sourceLine":709,"sourceFile":"vector"},{"imageOffset":62468,"sourceLine":1188,"sourceFile":"vector","symbol":"std::__1::vector >::vector > >(std::__1::istreambuf_iterator >, std::__1::enable_if<((__is_cpp17_input_iterator > >::value) && (!(__is_cpp17_forward_iterator > >::value))) && (is_constructible > >::reference>::value), std::__1::istreambuf_iterator > >::type)","imageIndex":1,"symbolLocation":972},{"symbol":"std::__1::vector >::vector > >(std::__1::istreambuf_iterator >, std::__1::enable_if<((__is_cpp17_input_iterator > >::value) && (!(__is_cpp17_forward_iterator > >::value))) && (is_constructible > >::reference>::value), std::__1::istreambuf_iterator > >::type)","inline":true,"imageIndex":1,"imageOffset":42240,"symbolLocation":16,"sourceLine":1183,"sourceFile":"vector"},{"symbol":"readVectorFromStream(std::__1::basic_istream >&)","inline":true,"imageIndex":1,"imageOffset":42240,"symbolLocation":152,"sourceLine":148,"sourceFile":"BloomFilter.cpp"},{"symbol":"readVectorFromFile(std::__1::basic_string, std::__1::allocator > const&)","inline":true,"imageIndex":1,"imageOffset":42240,"symbolLocation":744,"sourceLine":144,"sourceFile":"BloomFilter.cpp"},{"imageOffset":42240,"sourceLine":54,"sourceFile":"BloomFilter.cpp","symbol":"BloomFilter::BloomFilter(std::__1::basic_string, std::__1::allocator > const&, unsigned long, unsigned long)","imageIndex":1,"symbolLocation":1124},{"imageOffset":42620,"sourceLine":52,"sourceFile":"BloomFilter.cpp","symbol":"BloomFilter::BloomFilter(std::__1::basic_string, std::__1::allocator > const&, unsigned long, unsigned long)","imageIndex":1,"symbolLocation":60},{"imageOffset":35032,"sourceLine":32,"sourceFile":"BloomFilterWrapper.mm","symbol":"-[BloomFilterWrapper initFromPath:withBitCount:andTotalItems:]","imageIndex":1,"symbolLocation":316},{"imageOffset":3254940,"sourceFile":"HTTPSUpgradeStore.swift","symbol":"@nonobjc BloomFilterWrapper.init(fromPath:withBitCount:andTotalItems:)","imageIndex":1,"symbolLocation":56,"inline":true},{"imageOffset":3254940,"sourceFile":"","symbol":"BloomFilterWrapper.__allocating_init(fromPath:withBitCount:andTotalItems:)","imageIndex":1,"symbolLocation":84,"inline":true},{"imageOffset":3254940,"sourceLine":65,"sourceFile":"HTTPSUpgradeStore.swift","symbol":"HTTPSUpgradePersistence.bloomFilter()","imageIndex":1,"symbolLocation":760},{"imageOffset":463432,"sourceFile":"","symbol":"protocol witness for HTTPSUpgradeStore.bloomFilter() in conformance HTTPSUpgradePersistence","imageIndex":1,"symbolLocation":12,"inline":true},{"imageOffset":463432,"sourceLine":108,"sourceFile":"HTTPSUpgrade.swift","symbol":"HTTPSUpgrade.loadData()","imageIndex":1,"symbolLocation":136},{"imageOffset":463100,"sourceLine":99,"sourceFile":"HTTPSUpgrade.swift","symbol":"closure #1 in HTTPSUpgrade.loadDataAsync()","imageIndex":1,"symbolLocation":48},{"imageOffset":463160,"sourceFile":"","symbol":"partial apply for closure #1 in HTTPSUpgrade.loadDataAsync()","symbolLocation":28,"imageIndex":1},{"imageOffset":137448,"sourceFile":"","symbol":"thunk for @escaping @callee_guaranteed () -> ()","symbolLocation":56,"imageIndex":1},{"imageOffset":494104,"symbol":"__tsan::invoke_and_release_block(void*)","symbolLocation":32,"imageIndex":6},{"imageOffset":493356,"symbol":"__tsan::dispatch_callback_wrap(void*)","symbolLocation":300,"imageIndex":6},{"imageOffset":15276,"symbol":"_dispatch_client_callout","symbolLocation":20,"imageIndex":7},{"imageOffset":87100,"symbol":"_dispatch_root_queue_drain","symbolLocation":684,"imageIndex":7},{"imageOffset":88920,"symbol":"_dispatch_worker_thread2","symbolLocation":164,"imageIndex":7},{"imageOffset":13684,"symbol":"_pthread_wqthread","symbolLocation":228,"imageIndex":5},{"imageOffset":8900,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":5}]},{"id":1134809,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134829,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134830,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134848,"frames":[{"imageOffset":20156,"symbol":"__semwait_signal","symbolLocation":8,"imageIndex":8},{"imageOffset":60808,"symbol":"nanosleep","symbolLocation":216,"imageIndex":9},{"imageOffset":60580,"symbol":"usleep","symbolLocation":68,"imageIndex":9},{"imageOffset":432168,"symbol":"__tsan::BackgroundThread(void*)","symbolLocation":476,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134849,"name":"com.apple.NSEventThread","frames":[{"imageOffset":6484,"symbol":"mach_msg_trap","symbolLocation":8,"imageIndex":8},{"imageOffset":7424,"symbol":"mach_msg","symbolLocation":76,"imageIndex":8},{"imageOffset":544312,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":372,"imageIndex":10},{"imageOffset":537328,"symbol":"__CFRunLoopRun","symbolLocation":1212,"imageIndex":10},{"imageOffset":534164,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":10},{"imageOffset":1764388,"symbol":"_NSEventThread","symbolLocation":196,"imageIndex":2},{"imageOffset":183588,"symbol":"__tsan_thread_start_func","symbolLocation":172,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134850,"name":"Heap Helper Thread","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":8},{"imageOffset":31412,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":5},{"imageOffset":491808,"symbol":"__tsan::call_pthread_cancel_with_cleanup(int (*)(void*), void (*)(void*), void*)","symbolLocation":72,"imageIndex":6},{"imageOffset":187168,"symbol":"wrap_pthread_cond_timedwait","symbolLocation":684,"imageIndex":6},{"imageOffset":17705152,"symbol":"WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&)","symbolLocation":1860,"imageIndex":11},{"imageOffset":9340788,"symbol":"bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&)","symbolLocation":196,"imageIndex":11},{"imageOffset":17529160,"symbol":"WTF::Detail::CallableWrapper::call()","symbolLocation":260,"imageIndex":11},{"imageOffset":17815588,"symbol":"WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)","symbolLocation":168,"imageIndex":11},{"imageOffset":44592,"symbol":"WTF::wtfThreadEntryPoint(void*)","symbolLocation":16,"imageIndex":11},{"imageOffset":183588,"symbol":"__tsan_thread_start_func","symbolLocation":172,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134851,"name":"Heap Helper Thread","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":8},{"imageOffset":31412,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":5},{"imageOffset":491808,"symbol":"__tsan::call_pthread_cancel_with_cleanup(int (*)(void*), void (*)(void*), void*)","symbolLocation":72,"imageIndex":6},{"imageOffset":187168,"symbol":"wrap_pthread_cond_timedwait","symbolLocation":684,"imageIndex":6},{"imageOffset":17705152,"symbol":"WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&)","symbolLocation":1860,"imageIndex":11},{"imageOffset":9340788,"symbol":"bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&)","symbolLocation":196,"imageIndex":11},{"imageOffset":17529160,"symbol":"WTF::Detail::CallableWrapper::call()","symbolLocation":260,"imageIndex":11},{"imageOffset":17815588,"symbol":"WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)","symbolLocation":168,"imageIndex":11},{"imageOffset":44592,"symbol":"WTF::wtfThreadEntryPoint(void*)","symbolLocation":16,"imageIndex":11},{"imageOffset":183588,"symbol":"__tsan_thread_start_func","symbolLocation":172,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134852,"name":"Heap Helper Thread","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":8},{"imageOffset":31412,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":5},{"imageOffset":491808,"symbol":"__tsan::call_pthread_cancel_with_cleanup(int (*)(void*), void (*)(void*), void*)","symbolLocation":72,"imageIndex":6},{"imageOffset":187168,"symbol":"wrap_pthread_cond_timedwait","symbolLocation":684,"imageIndex":6},{"imageOffset":17705152,"symbol":"WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&)","symbolLocation":1860,"imageIndex":11},{"imageOffset":9340788,"symbol":"bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&)","symbolLocation":196,"imageIndex":11},{"imageOffset":17529160,"symbol":"WTF::Detail::CallableWrapper::call()","symbolLocation":260,"imageIndex":11},{"imageOffset":17815588,"symbol":"WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)","symbolLocation":168,"imageIndex":11},{"imageOffset":44592,"symbol":"WTF::wtfThreadEntryPoint(void*)","symbolLocation":16,"imageIndex":11},{"imageOffset":183588,"symbol":"__tsan_thread_start_func","symbolLocation":172,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134855,"name":"com.apple.coreanimation.render-server","frames":[{"imageOffset":6484,"symbol":"mach_msg_trap","symbolLocation":8,"imageIndex":8},{"imageOffset":7424,"symbol":"mach_msg","symbolLocation":76,"imageIndex":8},{"imageOffset":290528,"symbol":"CA::Render::Server::server_thread(void*)","symbolLocation":508,"imageIndex":12},{"imageOffset":290004,"symbol":"thread_fun(void*)","symbolLocation":32,"imageIndex":12},{"imageOffset":183588,"symbol":"__tsan_thread_start_func","symbolLocation":172,"imageIndex":6},{"imageOffset":29932,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":5},{"imageOffset":8912,"symbol":"thread_start","symbolLocation":8,"imageIndex":5}]},{"id":1134861,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134863,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]},{"id":1134864,"frames":[{"imageOffset":8892,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":5}]}], + "usedImages" : [ + { + "source" : "P", + "arch" : "arm64e", + "base" : 7095345152, + "size" : 4534272, + "uuid" : "f1ea4e09-e952-3bf4-b198-075ca1378456", + "path" : "\/usr\/lib\/swift\/libswiftCore.dylib", + "name" : "libswiftCore.dylib" + }, + { + "source" : "P", + "arch" : "arm64", + "base" : 4332011520, + "CFBundleShortVersionString" : "0.17.3", + "CFBundleIdentifier" : "com.duckduckgo.macos.browser", + "size" : 11780096, + "uuid" : "7fc6ff2c-a85d-3116-96d9-9368ec955ba1", + "path" : "\/Users\/USER\/Library\/Developer\/Xcode\/DerivedData\/DuckDuckGo-btirywidbxinwsbhskhemidiqvyo\/Build\/Products\/Release\/DuckDuckGo.app\/Contents\/MacOS\/DuckDuckGo", + "name" : "DuckDuckGo", + "CFBundleVersion" : "0.17.3" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6922821632, + "CFBundleShortVersionString" : "6.9", + "CFBundleIdentifier" : "com.apple.AppKit", + "size" : 15409152, + "uuid" : "518f4e68-c324-320f-9d7f-85c224eae972", + "path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit", + "name" : "AppKit", + "CFBundleVersion" : "2113" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 7023689728, + "CFBundleShortVersionString" : "2.1.1", + "CFBundleIdentifier" : "com.apple.HIToolbox", + "size" : 3342336, + "uuid" : "98ea191e-b6f8-3036-b267-eeadb5f03c7d", + "path" : "\/System\/Library\/Frameworks\/Carbon.framework\/Versions\/A\/Frameworks\/HIToolbox.framework\/Versions\/A\/HIToolbox", + "name" : "HIToolbox" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 4376559616, + "size" : 393216, + "uuid" : "86a8ba48-8bb4-3b30-9cda-051f73c74f44", + "path" : "\/usr\/lib\/dyld", + "name" : "dyld" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6876798976, + "size" : 53248, + "uuid" : "4786e19a-9312-38e6-80ef-9c1394548118", + "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib", + "name" : "libsystem_pthread.dylib" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 4380688384, + "size" : 589824, + "uuid" : "fd4a5753-cc6e-3386-8674-83a7e629b804", + "path" : "\/Users\/USER\/Library\/Developer\/Xcode\/DerivedData\/DuckDuckGo-btirywidbxinwsbhskhemidiqvyo\/Build\/Products\/Release\/DuckDuckGo.app\/Contents\/Frameworks\/libclang_rt.tsan_osx_dynamic.dylib", + "name" : "libclang_rt.tsan_osx_dynamic.dylib" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6874984448, + "size" : 290816, + "uuid" : "3d7a56a3-23bf-3077-b5c6-9ce65ce7333e", + "path" : "\/usr\/lib\/system\/libdispatch.dylib", + "name" : "libdispatch.dylib" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6876577792, + "size" : 221184, + "uuid" : "c8524c02-b14f-30bd-a228-c44b4a448e68", + "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib", + "name" : "libsystem_kernel.dylib" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6875533312, + "size" : 528384, + "uuid" : "002a39ae-6431-3b2e-85e7-c45fc2f95ad0", + "path" : "\/usr\/lib\/system\/libsystem_c.dylib", + "name" : "libsystem_c.dylib" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6877118464, + "CFBundleShortVersionString" : "6.9", + "CFBundleIdentifier" : "com.apple.CoreFoundation", + "size" : 5521408, + "uuid" : "b2ff96d0-ae99-31ef-9014-fc9964b4f3e0", + "path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation", + "name" : "CoreFoundation", + "CFBundleVersion" : "1855.105" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 7279861760, + "CFBundleShortVersionString" : "17612", + "CFBundleIdentifier" : "com.apple.JavaScriptCore", + "size" : 19628032, + "uuid" : "1f13d2b9-d661-364f-8b67-865f68018e4a", + "path" : "\/System\/Library\/Frameworks\/JavaScriptCore.framework\/Versions\/A\/JavaScriptCore", + "name" : "JavaScriptCore", + "CFBundleVersion" : "17612.2.9.1.20" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 6993149952, + "CFBundleShortVersionString" : "1.11", + "CFBundleIdentifier" : "com.apple.QuartzCore", + "size" : 3137536, + "uuid" : "b7469cdd-ceae-3cb7-bb88-6c8d274d546a", + "path" : "\/System\/Library\/Frameworks\/QuartzCore.framework\/Versions\/A\/QuartzCore", + "name" : "QuartzCore", + "CFBundleVersion" : "962.57.1" + } +], + "sharedCache" : { + "base" : 6873628672, + "size" : 3072180224, + "uuid" : "a6162d66-93e3-3251-93cc-b11f7c8c830e" +}, + "vmSummary" : "ReadOnly portion of Libraries: Total=1.1G resident=0K(0%) swapped_out_or_unallocated=1.1G(100%)\nWritable regions: Total=35.0T written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=35.0T(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nAccelerate framework 512K 4 \nActivity Tracing 256K 1 \nCG backing stores 6912K 8 \nCG image 816K 8 \nColorSync 528K 26 \nCoreAnimation 5600K 43 \nCoreData Object IDs 4112K 2 \nCoreGraphics 64K 4 \nCoreUI image data 1264K 10 \nDispatch continuations 80.0M 1 \nFoundation 16K 1 \nImage IO 32K 2 \nKernel Alloc Once 32K 1 \nMALLOC 144K 6 \nMALLOC guard page 96K 5 \nSQLite page cache 384K 6 \nSTACK GUARD 56.3M 17 \nSanitizer 88.5T 1474 \nSanitizer (reserved) 35.0T 135 reserved VM address space (unallocated)\nStack 17.0M 17 \nVM_ALLOCATE 1.0G 22 \nWebKit Malloc 128.0M 1 \n__AUTH 2670K 323 \n__AUTH_CONST 20.0M 511 \n__DATA 28.9M 505 \n__DATA_CONST 17.7M 521 \n__DATA_DIRTY 1846K 217 \n__FONT_DATA 4K 1 \n__GLSLBUILTINS 5176K 1 \n__LINKEDIT 596.4M 9 \n__LLVM_COV 1696K 1 \n__OBJC_CONST 3386K 278 \n__OBJC_RO 81.8M 1 \n__OBJC_RW 3088K 1 \n__TEXT 496.7M 539 \n__UNICODE 588K 1 \ndyld private memory 1024K 1 \nlibnetwork 128K 8 \nmapped file 187.6M 65 \nshared memory 880K 15 \n=========== ======= ======= \nTOTAL 123.5T 4792 \nTOTAL, minus reserved VM space 88.5T 4792 \n", + "legacyInfo" : { + "threadTriggered" : { + "queue" : "com.apple.main-thread" + } +}, + "trialInfo" : { + "rollouts" : [ + { + "rolloutId" : "602ad4dac86151000cf27e46", + "factorPackIds" : { + "SIRI_DICTATION_ASSETS" : "6182cb1f4b3765609b8b76cb" + }, + "deploymentId" : 240000254 + }, + { + "rolloutId" : "5fc94383418129005b4e9ae0", + "factorPackIds" : { + + }, + "deploymentId" : 240000153 + }, + { + "rolloutId" : "5ffde50ce2aacd000d47a95f", + "factorPackIds" : { + + }, + "deploymentId" : 240000068 + }, + { + "rolloutId" : "60da5e84ab0ca017dace9abf", + "factorPackIds" : { + + }, + "deploymentId" : 240000008 + }, + { + "rolloutId" : "607844aa04477260f58a8077", + "factorPackIds" : { + "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a" + }, + "deploymentId" : 240000066 + }, + { + "rolloutId" : "601d9415f79519000ccd4b69", + "factorPackIds" : { + "SIRI_TEXT_TO_SPEECH" : "618455f04b3765609b8b78c1" + }, + "deploymentId" : 240000311 + } + ], + "experiments" : [ + + ] +} +} + +System Profile: +Network Service: Wi-Fi, AirPort, en0 +Thunderbolt Bus: MacBook Pro, Apple Inc. +Thunderbolt Bus: MacBook Pro, Apple Inc. +Thunderbolt Bus: MacBook Pro, Apple Inc. +Boot Volume File System Type: apfs +Memory Module: LPDDR5 +USB Device: USB31Bus +USB Device: USB31Bus +USB Device: USB31Bus +Display: DELL P2715Q, 3840 x 2160 (2160p/4K UHD 1 - Ultra High Definition), Main, MirrorOff, Online +Display: Color LCD, 3456 x 2234 Retina, MirrorOff, Online +Model: MacBookPro18,1, BootROM 7429.41.5, proc 10:8:2 processors, 32 GB, SMC +Graphics: Apple M1 Pro, Apple M1 Pro, Built-In +AirPort: Wi-Fi, wl0: Sep 24 2021 15:49:44 version 20.10.853.23.8.7.106 FWID 01-78e271b2 +Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports From 95b872381b76d312e68a5e9db1ee2f7d0111070e Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Thu, 11 Nov 2021 18:38:31 -0800 Subject: [PATCH 02/13] TEMP: Changes to allow sending crashes to a dev instance in DEBUG mode. Revert this! --- .../xcshareddata/swiftpm/Package.resolved | 15 ++++++++++++--- .../Model/CrashReportSender.swift | 8 +++++++- .../Crash Reports/Model/CrashReporter.swift | 18 ++++++++---------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 26584f9eb2..c46466a54f 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/duckduckgo/BrowserServicesKit.git", "state": { "branch": "release/friends-and-family", - "revision": "65b012ca808d534f2d46a368bff83a7ec1de3b92", + "revision": "6fd3f7d652b318a1b4986f50222d3af27edbca15", "version": null } }, @@ -55,13 +55,22 @@ "version": "1.26.0" } }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "6b2aa2748a7881eebb9f84fb10c01293e15b52ca", + "version": "0.5.0" + } + }, { "package": "TrackerRadarKit", "repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit.git", "state": { "branch": null, - "revision": "a11e97e591273845519b6b06ddbb6ba88eab2195", - "version": "1.0.2" + "revision": "5f4caf35b8418700a48c64c7c61eb43308c8dacc", + "version": "1.0.3" } } ] diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift index a9972da39f..6c5053eff6 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift @@ -22,7 +22,7 @@ import Foundation final class CrashReportSender { - static let reportServiceUrl = URL(string: "https://duckduckgo.com/crash.js")! + static let reportServiceUrl = URL(string: "https://use-devtesting10.duckduckgo.com/crash.js")! func send(_ crashReport: CrashReport) { guard let contentData = crashReport.contentData else { @@ -34,7 +34,13 @@ final class CrashReportSender { request.setValue("ddg_mac", forHTTPHeaderField: "User-Agent") request.httpMethod = "POST" request.httpBody = contentData + request.httpShouldHandleCookies = true + + // Visit the report service URL in a webpage and monitor the request, pull out the Duo cookie and paste it here in order for crashes to send. + request.setValue("", forHTTPHeaderField: "Cookie") + print("SENDING CRASH: \(request)") + URLSession.shared.dataTask(with: request) { (_, _, error) in if error != nil { assertionFailure("CrashReportSender: Failed to send the crash reprot") diff --git a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift index 9e631b75d1..007a0ac9e8 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift @@ -33,13 +33,13 @@ final class CrashReporter { func checkForNewReports() { -#if !DEBUG - - guard let lastCheckDate = lastCheckDate else { - // Initial run - self.lastCheckDate = Date() - return - } +// guard let lastCheckDate = lastCheckDate else { +// // Initial run +// self.lastCheckDate = Date() +// return +// } + + let lastCheckDate = Date.distantPast let crashReports = reader.getCrashReports(since: lastCheckDate) self.lastCheckDate = Date() @@ -49,13 +49,11 @@ final class CrashReporter { return } - Pixel.fire(.crash) + // Pixel.fire(.crash) latestCrashReport = latest promptPresenter.showPrompt(self, for: latest) -#endif - } } From 15fe5da3d449e5a325857ab08f83759cd06aea71 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Mon, 6 Dec 2021 16:28:20 -0800 Subject: [PATCH 03/13] Reset the crash reporter service URL. --- DuckDuckGo/Crash Reports/Model/CrashReportSender.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift index 6c5053eff6..69aeddcabe 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift @@ -22,7 +22,7 @@ import Foundation final class CrashReportSender { - static let reportServiceUrl = URL(string: "https://use-devtesting10.duckduckgo.com/crash.js")! + static let reportServiceUrl = URL(string: "https://duckduckgo.com/crash.js")! func send(_ crashReport: CrashReport) { guard let contentData = crashReport.contentData else { From 11325affc15592f6e348a7384dab40e11082f676 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Sun, 6 Feb 2022 13:47:44 -0800 Subject: [PATCH 04/13] Resolve merge conflicts. --- DuckDuckGo.xcodeproj/project.pbxproj | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 57bde9d05c..a520a41c35 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -86,6 +86,8 @@ 4B677439255DBEB800025BD8 /* HTTPSUpgradeStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B677430255DBEB800025BD8 /* HTTPSUpgradeStore.swift */; }; 4B677442255DBEEA00025BD8 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B677440255DBEEA00025BD8 /* Database.swift */; }; 4B67744B255DBF3A00025BD8 /* BloomFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B677449255DBF3A00025BD8 /* BloomFilter.cpp */; }; + 4B70C00127B0793D000386ED /* DuckDuckGo-ExampleCrash.ips in Resources */ = {isa = PBXBuildFile; fileRef = 4B70BFFF27B0793D000386ED /* DuckDuckGo-ExampleCrash.ips */; }; + 4B70C00227B0793D000386ED /* CrashReportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B70C00027B0793D000386ED /* CrashReportTests.swift */; }; 4B723E0526B0003E00E14D75 /* DataImportMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B723DFF26B0003E00E14D75 /* DataImportMocks.swift */; }; 4B723E0626B0003E00E14D75 /* CSVParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B723E0026B0003E00E14D75 /* CSVParserTests.swift */; }; 4B723E0726B0003E00E14D75 /* CSVImporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B723E0126B0003E00E14D75 /* CSVImporterTests.swift */; }; @@ -765,6 +767,8 @@ 4B677449255DBF3A00025BD8 /* BloomFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BloomFilter.cpp; path = Submodules/bloom_cpp/src/BloomFilter.cpp; sourceTree = SOURCE_ROOT; }; 4B67744A255DBF3A00025BD8 /* BloomFilter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = BloomFilter.hpp; path = Submodules/bloom_cpp/src/BloomFilter.hpp; sourceTree = SOURCE_ROOT; }; 4B677454255DC18000025BD8 /* Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bridging.h; sourceTree = ""; }; + 4B70BFFF27B0793D000386ED /* DuckDuckGo-ExampleCrash.ips */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "DuckDuckGo-ExampleCrash.ips"; sourceTree = ""; }; + 4B70C00027B0793D000386ED /* CrashReportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrashReportTests.swift; sourceTree = ""; }; 4B723DEB26B0002B00E14D75 /* DataImport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataImport.swift; sourceTree = ""; }; 4B723DED26B0002B00E14D75 /* DataImport.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DataImport.storyboard; sourceTree = ""; }; 4B723DEE26B0002B00E14D75 /* DataImportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataImportViewController.swift; sourceTree = ""; }; @@ -1674,6 +1678,23 @@ name = bloom_cpp; sourceTree = ""; }; + 4B70BFFD27B0793D000386ED /* Crash Reports */ = { + isa = PBXGroup; + children = ( + 4B70BFFE27B0793D000386ED /* Example Crash Reports */, + 4B70C00027B0793D000386ED /* CrashReportTests.swift */, + ); + path = "Crash Reports"; + sourceTree = ""; + }; + 4B70BFFE27B0793D000386ED /* Example Crash Reports */ = { + isa = PBXGroup; + children = ( + 4B70BFFF27B0793D000386ED /* DuckDuckGo-ExampleCrash.ips */, + ); + path = "Example Crash Reports"; + sourceTree = ""; + }; 4B723DEA26B0002B00E14D75 /* Data Import */ = { isa = PBXGroup; children = ( @@ -2392,6 +2413,7 @@ 85F69B3A25EDE7F800978E59 /* Common */, 85AC3B1525D9BBFA00C7D2AA /* Configuration */, 4B82E9B725B6A04B00656FE7 /* ContentBlocker */, + 4B70BFFD27B0793D000386ED /* Crash Reports */, 4B723E0226B0003E00E14D75 /* Data Export */, B683097A274DCFE3004B46BB /* Database */, 4B723DFE26B0003E00E14D75 /* Data Import */, @@ -3743,6 +3765,7 @@ B69B50542726CD8100758A2B /* atb-with-update.json in Resources */, B69B50522726CD8100758A2B /* atb.json in Resources */, 4BB99D0B26FE1A7B001E4761 /* Bookmarks in Resources */, + 4B70C00127B0793D000386ED /* DuckDuckGo-ExampleCrash.ips in Resources */, 4B8AC94126B49BEE00879451 /* key4.db in Resources */, B67C6C422654BF49006C872E /* DuckDuckGo-Symbol.jpg in Resources */, B69B50552726CD8100758A2B /* invalid.json in Resources */, @@ -4376,6 +4399,7 @@ B6106BB326A7F4AA0013B453 /* GeolocationServiceMock.swift in Sources */, 4B8AC93D26B49BE600879451 /* FirefoxLoginReaderTests.swift in Sources */, 4B723E0526B0003E00E14D75 /* DataImportMocks.swift in Sources */, + 4B70C00227B0793D000386ED /* CrashReportTests.swift in Sources */, 85AC3B1725D9BC1A00C7D2AA /* ConfigurationDownloaderTests.swift in Sources */, B693955D26F19CD70015B914 /* DownloadListStoreTests.swift in Sources */, 4B0511E7262CAB3700F6079C /* UserDefaultsWrapperUtilities.swift in Sources */, From 78ac608fc8ef7f3bcd75c31137d8ba05dc1c276e Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Sun, 6 Feb 2022 14:39:42 -0800 Subject: [PATCH 05/13] Considering parsing the macOS 12 format. --- .../Crash Reports/Model/CrashReport.swift | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReport.swift b/DuckDuckGo/Crash Reports/Model/CrashReport.swift index 4e86a90e3c..8d19c1dfa8 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReport.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReport.swift @@ -92,4 +92,26 @@ struct JSONCrashReport: CrashReport { } +/// Encapsulates the logic for decoding and encoding a JSON crash report. +/// This is done so that we only read the values that the crash report requires to symbolicate, and nothing more. +/// It is encoded back into the .ips format, but without the values from the original report that the symbolicator does not need to function. +struct DecodableJSONCrashReport { + + static func decode(from string: String) -> DecodableJSONCrashReport? { + return nil + } + + static func encode() -> String { + return "" + } + + struct Payload: Codable { + + } + + let metadata: String + let payload: Payload + +} + #endif From ea9bee28cf0a488c71a0913c0076d0ae09b55887 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 08:12:22 -0800 Subject: [PATCH 06/13] Remove the initial parsing code. --- .../Crash Reports/Model/CrashReport.swift | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReport.swift b/DuckDuckGo/Crash Reports/Model/CrashReport.swift index 8d19c1dfa8..4e86a90e3c 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReport.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReport.swift @@ -92,26 +92,4 @@ struct JSONCrashReport: CrashReport { } -/// Encapsulates the logic for decoding and encoding a JSON crash report. -/// This is done so that we only read the values that the crash report requires to symbolicate, and nothing more. -/// It is encoded back into the .ips format, but without the values from the original report that the symbolicator does not need to function. -struct DecodableJSONCrashReport { - - static func decode(from string: String) -> DecodableJSONCrashReport? { - return nil - } - - static func encode() -> String { - return "" - } - - struct Payload: Codable { - - } - - let metadata: String - let payload: Payload - -} - #endif From 9a3f9b94336a2c758ac20fd75b0f5e088f2d9b49 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 08:14:39 -0800 Subject: [PATCH 07/13] Restore crash pixel. --- DuckDuckGo/Crash Reports/Model/CrashReporter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift index 007a0ac9e8..34f7343311 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift @@ -49,7 +49,7 @@ final class CrashReporter { return } - // Pixel.fire(.crash) + Pixel.fire(.crash) latestCrashReport = latest promptPresenter.showPrompt(self, for: latest) From edec17348701d2acbd4c8b5b2a9c7ef1a702f4a2 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 08:15:00 -0800 Subject: [PATCH 08/13] Restore the last-check logic. --- DuckDuckGo/Crash Reports/Model/CrashReporter.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift index 34f7343311..2e277882dd 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift @@ -33,11 +33,11 @@ final class CrashReporter { func checkForNewReports() { -// guard let lastCheckDate = lastCheckDate else { -// // Initial run -// self.lastCheckDate = Date() -// return -// } + guard let lastCheckDate = lastCheckDate else { + // Initial run + self.lastCheckDate = Date() + return + } let lastCheckDate = Date.distantPast From 5eae0eb27d44dd4fe142105a92dbce78426b2ac7 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 08:15:26 -0800 Subject: [PATCH 09/13] Remove more old debugging code. --- DuckDuckGo/Crash Reports/Model/CrashReportSender.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift index eb48f1b2a6..7e89b965bd 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift @@ -36,11 +36,6 @@ final class CrashReportSender { request.httpBody = contentData request.httpShouldHandleCookies = true - // Visit the report service URL in a webpage and monitor the request, pull out the Duo cookie and paste it here in order for crashes to send. - request.setValue("", forHTTPHeaderField: "Cookie") - - print("SENDING CRASH: \(request)") - URLSession.default.dataTask(with: request) { (_, _, error) in if error != nil { assertionFailure("CrashReportSender: Failed to send the crash reprot") From 4f112c13a4153fffd7605dadf2a5a13cd5b1f2b3 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 10:50:06 -0800 Subject: [PATCH 10/13] Remove more unused changes. --- DuckDuckGo/Crash Reports/Model/CrashReportSender.swift | 3 +-- DuckDuckGo/Crash Reports/Model/CrashReporter.swift | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift index 7e89b965bd..fa60f57789 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportSender.swift @@ -34,8 +34,7 @@ final class CrashReportSender { request.setValue("ddg_mac", forHTTPHeaderField: "User-Agent") request.httpMethod = "POST" request.httpBody = contentData - request.httpShouldHandleCookies = true - + URLSession.default.dataTask(with: request) { (_, _, error) in if error != nil { assertionFailure("CrashReportSender: Failed to send the crash reprot") diff --git a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift index 2e277882dd..9e631b75d1 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReporter.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReporter.swift @@ -33,13 +33,13 @@ final class CrashReporter { func checkForNewReports() { +#if !DEBUG + guard let lastCheckDate = lastCheckDate else { // Initial run self.lastCheckDate = Date() return } - - let lastCheckDate = Date.distantPast let crashReports = reader.getCrashReports(since: lastCheckDate) self.lastCheckDate = Date() @@ -54,6 +54,8 @@ final class CrashReporter { latestCrashReport = latest promptPresenter.showPrompt(self, for: latest) +#endif + } } From f445f9798c0af9cd8f0931680abd68c75bbc9324 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 10:52:40 -0800 Subject: [PATCH 11/13] Use one place for tracking the file extensions. --- DuckDuckGo/Crash Reports/Model/CrashReportReader.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift b/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift index d9ddc8b719..27bf38b831 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReportReader.swift @@ -43,7 +43,7 @@ final class CrashReportReader { } private func isCrashReportPath(_ path: URL) -> Bool { - let validExtensions = ["crash", "ips"] + let validExtensions = [LegacyCrashReport.fileExtension, JSONCrashReport.fileExtension] return validExtensions.contains(path.pathExtension) } From 1614768fd22580480e76936928825feac98d8295 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 11:08:46 -0800 Subject: [PATCH 12/13] Strip out more data. --- DuckDuckGo/Crash Reports/Model/CrashReport.swift | 4 +++- Unit Tests/Crash Reports/CrashReportTests.swift | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReport.swift b/DuckDuckGo/Crash Reports/Model/CrashReport.swift index 4e86a90e3c..fbf32cfed0 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReport.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReport.swift @@ -64,7 +64,9 @@ struct JSONCrashReport: CrashReport { static let fileExtension = "ips" static let headerItemsToFilter = [ - "sleepWakeUUID" + "sleepWakeUUID", + "deviceIdentifierForVendor", + "rolloutId" ] let url: URL diff --git a/Unit Tests/Crash Reports/CrashReportTests.swift b/Unit Tests/Crash Reports/CrashReportTests.swift index 215e84f74c..f4ccd4d16b 100644 --- a/Unit Tests/Crash Reports/CrashReportTests.swift +++ b/Unit Tests/Crash Reports/CrashReportTests.swift @@ -36,8 +36,20 @@ class CrashReportTests: XCTestCase { // Verify that the content does not include the sleepWakeUUID anywhere in the report XCTAssertFalse(report.content!.contains("2384290E-F858-4024-9488-11D3FF94B4DD")) + // Verify that the content does not include the device identitier + XCTAssertFalse(report.content!.contains("483B097A-A969-596F-9F2A-357347BB1DEC")) + + // Verify that the content does not include any experiment rollout identifiers + XCTAssertFalse(report.content!.contains("602ad4dac86151000cf27e46")) + XCTAssertFalse(report.content!.contains("5fc94383418129005b4e9ae0")) + XCTAssertFalse(report.content!.contains("5ffde50ce2aacd000d47a95f")) + XCTAssertFalse(report.content!.contains("60da5e84ab0ca017dace9abf")) + XCTAssertFalse(report.content!.contains("607844aa04477260f58a8077")) + XCTAssertFalse(report.content!.contains("601d9415f79519000ccd4b69")) + // Verify that the sleepWakeUUID is definitely empty XCTAssert(report.content!.contains(#"sleepWakeUUID":""#)) + XCTAssert(report.content!.contains(#"deviceIdentifierForVendor":""#)) } private func ipsCrashURL() -> URL { From 315fba5110a5c16cdb417eaec06fc7f495b3eb60 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 18 Feb 2022 18:09:58 -0800 Subject: [PATCH 13/13] Fix up the regex. --- DuckDuckGo/Crash Reports/Model/CrashReport.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DuckDuckGo/Crash Reports/Model/CrashReport.swift b/DuckDuckGo/Crash Reports/Model/CrashReport.swift index fbf32cfed0..abf762f98a 100644 --- a/DuckDuckGo/Crash Reports/Model/CrashReport.swift +++ b/DuckDuckGo/Crash Reports/Model/CrashReport.swift @@ -77,9 +77,9 @@ struct JSONCrashReport: CrashReport { } for itemToFilter in Self.headerItemsToFilter { - let patternToReplace = "\"\(itemToFilter)\"\\s*:\\s*\".*\"" + let patternToReplace = "\"\(itemToFilter)\"\\s*:\\s*\"[^\"]*\"" let redactedKeyValuePair = "\"\(itemToFilter)\":\"\"" - + fileContents = fileContents.replacingOccurrences(of: patternToReplace, with: redactedKeyValuePair, options: .regularExpression)