microsoft / appcenter-sdk-apple

Development repository for the App Center SDK for iOS, macOS and tvOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding AppCenter SDK breaks the sqlite3-see.c used for SQLite and encryption

alilyinooma opened this issue · comments

Description

Adding AppCenter SDK breaks the sqlite3-see.c used for SQLite and encryption

Repro Steps

Please list the steps used to reproduce your issue.

  1. Create an iOS app with sqlite3-see.c as a SQLite engine powered by encryption (requires Obj-C++ wrappers around the SQLite C source code)
  2. Create and work with encrypted DB using sqlite3-see.c - everything works fine so far
  3. Add AppCenter iOS SDK to this app (via Swift PM)
  4. Try to work with encrypted DB created previously

Actual results:
Encrypted DB cannot be read, all new created "encrypted" dbs are not encrypted.

The root cause: AppCenter is forcefully linked with standard SQLite (with no encryption support), please see the linkerSettings in Package.swift, but AppCenter should not dictate which version of SQLite developers should link with. The linking must be done on the application side.

The same possible problem with zlib ("z") - developers may use zlib source code in their apps.

Details

  1. Which SDK version are you using? - Tested with all 4.x
  2. Which OS version did you experience the issue on? - 15.4
  3. Which Xcode version did you build the app with? - 13.4.1 (13F100)
  4. Which Cocoapods version are you using (run pod --version)? - N/A
  5. What device version did you see this error on? Were you using an emulator or a physical device? - iPhone 13 Pro (physical), all simulators
  6. What language are you using?
    • Objective C
    • Swift
    • C/C++
  7. What third party libraries are you using?
    • SQLite with security extension
  8. Please enable verbose logging for your app using MSAppCenter.setLogLevel(.verbose) before your call to MSAppCenter.start(...) for Swift, or [MSAppCenter setLogLevel:MSLogLevelVerbose] before [MSAppCenter start: ...] for Objective C and include the logs here:

2022-08-17 10:28:27.212395-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACDelegateForwarder addTraceBlock:]_block_invoke_2/88 Start buffering traces.
2022-08-17 10:28:27.212934-0700 Home Phone[11983:94294] [AppCenter] DEBUG: -[MSACDelegateForwarder setEnabledFromPlistForKey:]_block_invoke/278 Delegate forwarder for info.plist key 'AppCenterAppDelegateForwarderEnabled' enabled. It may use swizzling.
2022-08-17 10:28:27.213019-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: +[MSACDelegateForwarder flushTraceBuffer]/106 Stop buffering traces, flushed.
2022-08-17 10:28:27.213789-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACAppCenterUserDefaults migrateKeys:forService:]/35 Migrating the old NSDefaults keys to new ones.
2022-08-17 10:28:27.215349-0700 Home Phone[11983:94294] [AppCenter] DEBUG: -[MSACSessionContext init]/42 0 session(s) in the history.
2022-08-17 10:28:27.218519-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACSessionContext setSessionId:]/66 Stored new session with id:(null) and timestamp: 2022-08-17 17:28:27 +0000.
2022-08-17 10:28:27.218666-0700 Home Phone[11983:94294] [AppCenter] DEBUG: -[MSACUserIdContext init]/54 0 userId(s) in the history.
2022-08-17 10:28:27.263416-0700 Home Phone[11983:94294] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-08-17 10:28:27.265019-0700 Home Phone[11983:94294] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-08-17 10:28:27.265124-0700 Home Phone[11983:94294] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-08-17 10:28:27.265422-0700 Home Phone[11983:94294] [AppCenter] DEBUG: -[MSACDBStorage initWithSchema:version:filename:]_block_invoke/31 SQLite global configuration successfully updated.
2022-08-17 10:28:27.295310-0700 Home Phone[11983:94294] [AppCenter] INFO: -[MSACDBStorage configureDatabaseWithSchema:version:filename:]/90 Created "Logs.sqlite" database with 5 version.
2022-08-17 10:28:27.296498-0700 Home Phone[11983:94294] [AppCenter] DEBUG: +[MSACDBStorage enableAutoVacuumInOpenedDatabase:]/282 Vacuuming database and enabling auto_vacuum
2022-08-17 10:28:27.301013-0700 Home Phone[11983:94294] [AppCenter] INFO: -[MSACAppCenter configureWithAppSecret:transmissionTargetToken:fromApplication:]/350 App Center SDK configured successfully.
2022-08-17 10:28:27.301251-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACAppCenterUserDefaults migrateKeys:forService:]/35 Migrating the old NSDefaults keys to new ones.
2022-08-17 10:28:27.302017-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACAppCenterUserDefaults migrateKeys:forService:]/35 Migrating the old NSDefaults keys to new ones.
2022-08-17 10:28:27.306851-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACAppCenter startServices:withAppSecret:transmissionTargetToken:fromApplication:]/376 Start services MSACCrashes, MSACAnalytics from an application
2022-08-17 10:28:27.308386-0700 Home Phone[11983:94294] [AppCenterCrashes] DEBUG: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/707 EnableUncaughtExceptionHandler is set to YES
2022-08-17 10:28:27.308486-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/717 Enabled Mach exception handler.
2022-08-17 10:28:27.314619-0700 Home Phone[11983:94294] [AppCenterCrashes] WARNING: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/732 Detecting crashes is NOT enabled due to running the app with a debugger attached.
2022-08-17 10:28:27.319774-0700 Home Phone[11983:94294] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.319794-0700 Home Phone[11983:94514] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.320294-0700 Home Phone[11983:94294] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.320331-0700 Home Phone[11983:94548] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.320783-0700 Home Phone[11983:94294] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.320832-0700 Home Phone[11983:94536] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.321710-0700 Home Phone[11983:94536] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.321802-0700 Home Phone[11983:94536] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
2022-08-17 10:28:27.349968-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACSessionContext clearSessionHistoryAndKeepCurrentSession:]/88 Cleared old sessions.
2022-08-17 10:28:27.350147-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACUserIdContext clearUserIdHistory]/125 Cleared old userIds while keeping current userId.
2022-08-17 10:28:27.350245-0700 Home Phone[11983:94294] [AppCenterCrashes] INFO: -[MSACCrashes applyEnabledState:]/452 Crashes service has been enabled but the service cannot detect crashes due to running the application with a debugger attached.
2022-08-17 10:28:27.355965-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes startWithChannelGroup:appSecret:transmissionTargetToken:fromApplication:]/499 Started crash service.
2022-08-17 10:28:27.357071-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAnalytics: 0x600003cdc090> removed from pause lane for channel Analytics.
2022-08-17 10:28:27.357173-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics.
2022-08-17 10:28:27.357308-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAnalytics: 0x600003cdc090> removed from pause lane for channel Analytics/one.
2022-08-17 10:28:27.357412-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics/one.
2022-08-17 10:28:27.357575-0700 Home Phone[11983:94294] [AppCenter] VERBOSE: -[MSACSessionContext setSessionId:]/66 Stored new session with id:E64BDA6E-177A-445B-B2E1-8E5DCA8395EA and timestamp: 2022-08-17 17:28:27 +0000.
2022-08-17 10:28:27.357677-0700 Home Phone[11983:94294] [AppCenterAnalytics] INFO: -[MSACSessionTracker sendStartSession]/107 New session ID: E64BDA6E-177A-445B-B2E1-8E5DCA8395EA
2022-08-17 10:28:27.358106-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/582 Storing a log to Crashes Buffer: (sid: E64BDA6E-177A-445B-B2E1-8E5DCA8395EA, type: startSession)
2022-08-17 10:28:27.358212-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/593 Found an empty buffer position.
2022-08-17 10:28:27.358336-0700 Home Phone[11983:94294] [AppCenterAnalytics] INFO: -[MSACAnalytics applyEnabledState:]/182 Analytics service has been enabled.
2022-08-17 10:28:27.358379-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault enqueueItem:flags:]_block_invoke/156 Saving log, type: startSession, flags: 1.
2022-08-17 10:28:27.359403-0700 Home Phone[11983:94294] [AppCenterAnalytics] VERBOSE: -[MSACAnalytics startWithChannelGroup:appSecret:transmissionTargetToken:fromApplication:]/133 Started Analytics service.
2022-08-17 10:28:27.359845-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/582 Storing a log to Crashes Buffer: (sid: (null), type: startService)
2022-08-17 10:28:27.359964-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/605 Remembering index 0 for oldest timestamp 1660757307.358203.
2022-08-17 10:28:27.359968-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACLogDBStorage saveLog:withGroupId:flags:]_block_invoke/130 Log is stored with id: '1'
2022-08-17 10:28:27.360134-0700 Home Phone[11983:94294] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/593 Found an empty buffer position.
2022-08-17 10:28:27.360238-0700 Home Phone[11983:94539] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didCompleteEnqueueingLog:internalId:]/635 Deleting a log from buffer with id 44621829-5F5F-44AE-8EFA-C8E7717A6C0F
2022-08-17 10:28:27.360390-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault enqueueItem:flags:]_block_invoke/156 Saving log, type: startService, flags: 1.
2022-08-17 10:28:27.362067-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACLogDBStorage saveLog:withGroupId:flags:]_block_invoke/130 Log is stored with id: '2'
2022-08-17 10:28:27.362276-0700 Home Phone[11983:94539] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didCompleteEnqueueingLog:internalId:]/635 Deleting a log from buffer with id F3D031A5-56F4-4574-A2B9-8EEFC0A3B370
2022-08-17 10:28:27.393394-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel AppCenter.
2022-08-17 10:28:27.393614-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel AppCenter.
2022-08-17 10:28:27.393835-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel AppCenter/one.
2022-08-17 10:28:27.393927-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel AppCenter/one.
2022-08-17 10:28:27.394066-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Crashes.
2022-08-17 10:28:27.394162-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Crashes.
2022-08-17 10:28:27.394266-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Crashes/one.
2022-08-17 10:28:27.394368-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Crashes/one.
2022-08-17 10:28:27.394468-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel CrashesBuffer.
2022-08-17 10:28:27.394578-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel CrashesBuffer.
2022-08-17 10:28:27.394685-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel CrashesBuffer/one.
2022-08-17 10:28:27.394774-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel CrashesBuffer/one.
2022-08-17 10:28:27.394874-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics.
2022-08-17 10:28:27.394968-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics.
2022-08-17 10:28:27.395077-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics/one.
2022-08-17 10:28:27.395173-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics/one.
2022-08-17 10:28:27.395295-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics_critical.
2022-08-17 10:28:27.395418-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics_critical.
2022-08-17 10:28:27.395538-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics_critical/one.
2022-08-17 10:28:27.395636-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics_critical/one.
2022-08-17 10:28:27.395816-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel AppCenter/one.
2022-08-17 10:28:27.396004-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel AppCenter/one.
2022-08-17 10:28:27.396208-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Crashes/one.
2022-08-17 10:28:27.396302-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Crashes/one.
2022-08-17 10:28:27.396423-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel CrashesBuffer/one.
2022-08-17 10:28:27.396565-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel CrashesBuffer/one.
2022-08-17 10:28:27.396755-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics/one.
2022-08-17 10:28:27.424664-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics/one.
2022-08-17 10:28:27.424804-0700 Home Phone[11983:94539] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAppCenter: 0x6000025c20d0> removed from pause lane for channel Analytics_critical/one.
2022-08-17 10:28:27.424984-0700 Home Phone[11983:94539] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics_critical/one.

commented

Hi @alilyinooma , I couldn't find a possibility to set up an optional linking in Swift Package. Removing the sqlite linker would cause issues for all existing application using the SDK.

Since the project is open source, you can fork and setup the Swift Package based on your requirements.
Closing this issue.