diff --git a/CHANGES.md b/CHANGES.md index 7d361382e..cc6eb234a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,14 @@ +## Changes in 0.27.3 (2023-10-04) + +🐛 Bugfixes + +- Prevent crash when sending file with unrecognised file extension (no associated mime type) (mimetype) + +🧱 Build + +- Update Cocoapods to 1.13.0. ([#1820](https://github.com/matrix-org/matrix-ios-sdk/pull/1820)) + + ## Changes in 0.27.2 (2023-09-12) 🐛 Bugfixes diff --git a/Gemfile b/Gemfile index 294361724..f6e2a0038 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" gem "fastlane" -gem "cocoapods", '~>1.11.2' +gem "cocoapods", '~>1.13.0' gem "xcode-install" gem "slather" diff --git a/Gemfile.lock b/Gemfile.lock index c0c6a1028..e66916b79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,14 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.5) + CFPropertyList (3.0.6) rexml - activesupport (6.1.7) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -17,33 +16,33 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.674.0) - aws-sdk-core (3.168.4) + aws-partitions (1.828.0) + aws-sdk-core (3.183.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.61.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.71.0) + aws-sdk-core (~> 3, >= 3.177.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.117.2) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.136.0) + aws-sdk-core (~> 3, >= 3.181.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.5.2) + aws-sigv4 (~> 1.6) + aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) claide (1.1.0) clamp (1.3.2) - cocoapods (1.11.3) + cocoapods (1.13.0) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.3) + cocoapods-core (= 1.13.0) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-downloader (>= 1.6.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) @@ -51,10 +50,10 @@ GEM gh_inspector (~> 1.0) molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (>= 1.0, < 3.0) - xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.3) - activesupport (>= 5.0, < 7) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.13.0) + activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) @@ -76,9 +75,9 @@ GEM colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) declarative (0.0.20) - digest-crc (0.6.4) + digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) @@ -87,8 +86,8 @@ GEM escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.94.0) - faraday (1.10.2) + excon (0.103.0) + faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -116,8 +115,8 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.6) - fastlane (2.211.0) + fastimage (2.2.7) + fastlane (2.216.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -138,10 +137,11 @@ GEM google-apis-playcustomapp_v1 (~> 0.1) google-cloud-storage (~> 1.31) highline (~> 2.0) + http-cookie (~> 1.0.5) json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) - multipart-post (~> 2.0.0) + multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) @@ -149,20 +149,20 @@ GEM security (= 0.1.3) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) + terminal-table (~> 3) tty-screen (>= 0.6.3, < 1.0.0) tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) - ffi (1.15.5) + ffi (1.16.2) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.31.0) - google-apis-core (>= 0.9.1, < 2.a) - google-apis-core (0.9.1) + google-apis-androidpublisher_v3 (0.50.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -171,10 +171,10 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.16.0) - google-apis-core (>= 0.9.1, < 2.a) - google-apis-playcustomapp_v1 (0.12.0) - google-apis-core (>= 0.9.1, < 2.a) + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) google-apis-storage_v1 (0.19.0) google-apis-core (>= 0.9.0, < 2.a) google-cloud-core (1.6.0) @@ -182,7 +182,7 @@ GEM google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.0) + google-cloud-errors (1.3.1) google-cloud-storage (1.44.0) addressable (~> 2.8) digest-crc (~> 0.4) @@ -191,10 +191,9 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.3.0) + googleauth (1.8.1) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) @@ -202,60 +201,59 @@ GEM http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) jmespath (1.6.2) json (2.6.3) - jwt (2.5.0) - memoist (0.16.2) + jwt (2.7.1) mini_magick (4.12.0) - mini_mime (1.1.2) - mini_portile2 (2.8.0) - minitest (5.16.3) + mini_mime (1.1.5) + mini_portile2 (2.8.4) + minitest (5.20.0) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.0.0) + multipart-post (2.3.0) nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) netrc (0.11.0) - nokogiri (1.13.10) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) optparse (0.1.1) os (1.1.4) - plist (3.6.0) + plist (3.7.0) public_suffix (4.0.7) - racc (1.6.1) + racc (1.7.1) rake (13.0.6) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.5) + rexml (3.2.6) rouge (2.0.7) ruby-macho (2.5.1) ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.17.0) + signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simctl (1.6.8) + simctl (1.6.10) CFPropertyList naturally - slather (2.7.3) + slather (2.7.4) CFPropertyList (>= 2.2, < 4) activesupport clamp (~> 1.3) nokogiri (>= 1.13.9) xcodeproj (~> 1.21) terminal-notifier (2.0.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) @@ -263,19 +261,19 @@ GEM tty-cursor (~> 0.7) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (1.8.0) - webrick (1.7.0) + unicode-display_width (2.4.2) + webrick (1.8.1) word_wrap (1.0.0) xcode-install (2.8.1) claide (>= 0.9.1) fastlane (>= 2.1.0, < 3.0.0) - xcodeproj (1.22.0) + xcodeproj (1.23.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -286,13 +284,12 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - zeitwerk (2.6.6) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.11.2) + cocoapods (~> 1.13.0) fastlane slather xcode-install diff --git a/MatrixSDK.podspec b/MatrixSDK.podspec index 971a267ec..abcfc24f7 100644 --- a/MatrixSDK.podspec +++ b/MatrixSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MatrixSDK" - s.version = "0.27.2" + s.version = "0.27.3" s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)" s.description = <<-DESC @@ -45,7 +45,7 @@ Pod::Spec.new do |s| ss.dependency 'OLMKit', '~> 3.2.5' ss.dependency 'Realm', '10.27.0' ss.dependency 'libbase58', '~> 0.1.4' - ss.dependency 'MatrixSDKCrypto', '0.3.12', :configurations => ["DEBUG", "RELEASE"], :inhibit_warnings => true + ss.dependency 'MatrixSDKCrypto', '0.3.13', :configurations => ["DEBUG", "RELEASE"], :inhibit_warnings => true end s.subspec 'JingleCallStack' do |ss| diff --git a/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift b/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift index da4f1ff2f..370cf71af 100644 --- a/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift +++ b/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift @@ -613,6 +613,23 @@ extension MXCryptoMachine: MXCryptoCrossSigning { log.error("Failed importing cross signing keys", context: error) } } + + func queryMissingSecretsFromOtherSessions() async throws { + let isMissingSecrets = try machine.queryMissingSecretsFromOtherSessions() + + if (isMissingSecrets) { + // Out-of-sync check if there are any secret request to send out as a result of + // the missing secret request + for request in try machine.outgoingRequests() { + if case .toDevice(_, let eventType, _) = request { + if (eventType == kMXEventTypeStringSecretRequest) { + try await handleRequest(request) + } + } + } + } + } + } extension MXCryptoMachine: MXCryptoVerifying { diff --git a/MatrixSDK/Crypto/CryptoMachine/MXCryptoProtocols.swift b/MatrixSDK/Crypto/CryptoMachine/MXCryptoProtocols.swift index 2a53e44f4..b9b4dabc7 100644 --- a/MatrixSDK/Crypto/CryptoMachine/MXCryptoProtocols.swift +++ b/MatrixSDK/Crypto/CryptoMachine/MXCryptoProtocols.swift @@ -90,6 +90,8 @@ protocol MXCryptoCrossSigning: MXCryptoUserIdentitySource, MXCryptoDevicesSource func bootstrapCrossSigning(authParams: [AnyHashable: Any]) async throws func exportCrossSigningKeys() -> CrossSigningKeyExport? func importCrossSigningKeys(export: CrossSigningKeyExport) + + func queryMissingSecretsFromOtherSessions() async throws } /// Verification functionality diff --git a/MatrixSDK/Crypto/MXCryptoV2.swift b/MatrixSDK/Crypto/MXCryptoV2.swift index 60fbda52b..2e5c642b7 100644 --- a/MatrixSDK/Crypto/MXCryptoV2.swift +++ b/MatrixSDK/Crypto/MXCryptoV2.swift @@ -387,18 +387,37 @@ class MXCryptoV2: NSObject, MXCrypto { case .verified: // If we want to set verified status, we will manually verify the device, // including uploading relevant signatures + try? machine.setLocalTrust(userId: machine.userId, deviceId: deviceId, trust: .verified) - Task { - do { - try await machine.verifyDevice(userId: userId, deviceId: deviceId) - log.debug("Successfully marked device as verified") - await MainActor.run { - success?() + if (userId == machine.userId) { + if (machine.crossSigningStatus().hasSelfSigning) { + // If we can cross sign, upload a new signature for that device + Task { + do { + try await machine.verifyDevice(userId: userId, deviceId: deviceId) + log.debug("Successfully marked device as verified") + await MainActor.run { + success?() + } + } catch { + log.error("Failed marking device as verified", context: error) + await MainActor.run { + failure?(error) + } + } } - } catch { - log.error("Failed marking device as verified", context: error) - await MainActor.run { - failure?(error) + } else { + // It's a good time to request secrets + Task { + do { + try await machine.queryMissingSecretsFromOtherSessions() + await MainActor.run { + success?() + } + } catch { + log.error("Failed to query missing secrets", context: error) + failure?(error) + } } } } diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index b626989f0..7d88cc258 100644 --- a/MatrixSDK/Data/MXRoom.m +++ b/MatrixSDK/Data/MXRoom.m @@ -1020,7 +1020,7 @@ - (MXHTTPOperation*)sendImage:(NSData*)imageData kMXMessageBodyKey: filename, @"url": fakeMediaURI, @"info": [@{ - @"mimetype": mimetype, + @"mimetype": (mimetype ?: @"application/octet-stream"), @"w": @(imageSize.width), @"h": @(imageSize.height), @"size": @(imageData.length) @@ -1347,7 +1347,7 @@ - (MXHTTPOperation*)sendVideoAsset:(AVAsset*)videoAsset } // update metadata with result of converter output - msgContent[@"info"][@"mimetype"] = mimetype; + msgContent[@"info"][@"mimetype"] = (mimetype ?: @"application/octet-stream"); msgContent[@"info"][@"w"] = @(size.width); msgContent[@"info"][@"h"] = @(size.height); msgContent[@"info"][@"duration"] = @((int)floor(durationInMs)); @@ -1670,7 +1670,7 @@ - (MXHTTPOperation*)_sendFile:(NSURL*)fileLocalURL kMXMessageBodyKey: filename, @"url": fakeMediaURI, @"info": @{ - @"mimetype": mimeType, + @"mimetype": (mimeType ?: @"application/octet-stream"), @"size": @(fileData.length) }, kMXMessageContentKeyExtensibleTextMSC1767: filename, @@ -1678,7 +1678,7 @@ - (MXHTTPOperation*)_sendFile:(NSURL*)fileLocalURL kMXMessageContentKeyExtensibleFileSize: @(fileData.length), kMXMessageContentKeyExtensibleFileName: filename, kMXMessageContentKeyExtensibleFileURL: fakeMediaURI, - kMXMessageContentKeyExtensibleFileMimeType: mimeType + kMXMessageContentKeyExtensibleFileMimeType: (mimeType ?: @"application/octet-stream") }.mutableCopy}.mutableCopy; if(additionalTypes.count) diff --git a/MatrixSDK/MatrixSDKVersion.m b/MatrixSDK/MatrixSDKVersion.m index 56bbdf50e..f52dff165 100644 --- a/MatrixSDK/MatrixSDKVersion.m +++ b/MatrixSDK/MatrixSDKVersion.m @@ -16,4 +16,4 @@ #import -NSString *const MatrixSDKVersion = @"0.27.2"; +NSString *const MatrixSDKVersion = @"0.27.3"; diff --git a/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift b/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift index 8ab364c5b..171d3b6ba 100644 --- a/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift +++ b/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift @@ -163,6 +163,10 @@ class CryptoCrossSigningStub: CryptoIdentityStub, MXCryptoCrossSigning { func dehydratedDevices() -> DehydratedDevicesProtocol { fatalError() } + + func queryMissingSecretsFromOtherSessions() async throws { + + } } class CryptoVerificationStub: CryptoIdentityStub { diff --git a/Podfile b/Podfile index e6c59ed52..f48b15351 100644 --- a/Podfile +++ b/Podfile @@ -16,7 +16,7 @@ abstract_target 'MatrixSDK' do pod 'Realm', '10.27.0' pod 'libbase58', '~> 0.1.4' - pod 'MatrixSDKCrypto', "0.3.12", :inhibit_warnings => true + pod 'MatrixSDKCrypto', "0.3.13", :inhibit_warnings => true target 'MatrixSDK-iOS' do platform :ios, '11.0' diff --git a/Podfile.lock b/Podfile.lock index 99f9debfc..b816768da 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -16,7 +16,7 @@ PODS: - AFNetworking/NSURLSession - GZIP (1.3.0) - libbase58 (0.1.4) - - MatrixSDKCrypto (0.3.12) + - MatrixSDKCrypto (0.3.13) - OHHTTPStubs (9.1.0): - OHHTTPStubs/Default (= 9.1.0) - OHHTTPStubs/Core (9.1.0) @@ -44,7 +44,7 @@ DEPENDENCIES: - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) - - MatrixSDKCrypto (= 0.3.12) + - MatrixSDKCrypto (= 0.3.13) - OHHTTPStubs (~> 9.1.0) - OLMKit (~> 3.2.5) - Realm (= 10.27.0) @@ -65,12 +65,12 @@ SPEC CHECKSUMS: AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 GZIP: 416858efbe66b41b206895ac6dfd5493200d95b3 libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd - MatrixSDKCrypto: 25929a40733b4ab54f659aaf6a730552a0a06504 + MatrixSDKCrypto: bf08b72f2cd015d8749420a2b8b92fc0536bedf4 OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831 OLMKit: da115f16582e47626616874e20f7bb92222c7a51 Realm: 9ca328bd7e700cc19703799785e37f77d1a130f2 SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82 -PODFILE CHECKSUM: e70d3694981265116ff81a851fb0c1c9654995cd +PODFILE CHECKSUM: 1bf28f5a19566c567d265232f60ee19a3ae86ed3 -COCOAPODS: 1.11.3 +COCOAPODS: 1.13.0