From 8bf871104ef1120135e142cc7cd43701668ac023 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 12 Sep 2023 09:45:24 +0300 Subject: [PATCH 01/11] Prepare for new sprint From 36a9d9cec9a8626f43e7654f0e064c0f1daafa37 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 27 Sep 2023 16:28:39 +0200 Subject: [PATCH 02/11] Prevent crash when sending file with unrecognised file extension (no associated mime type) Signed-off-by: Nicolas Buquet --- MatrixSDK/Data/MXRoom.m | 8 ++++---- changelog.d/mimetype.bugfix | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/mimetype.bugfix diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index b626989f0b..fe1a3a167b 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/changelog.d/mimetype.bugfix b/changelog.d/mimetype.bugfix new file mode 100644 index 0000000000..e4287e0b86 --- /dev/null +++ b/changelog.d/mimetype.bugfix @@ -0,0 +1 @@ +Prevent crash when sending file with unrecognised file extension (no associated mime type) \ No newline at end of file From 626e03ffc7a249458732f0ea743ab3fe96746db9 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 28 Sep 2023 10:00:21 +0100 Subject: [PATCH 03/11] Update cocoapods to 1.13.0. (#1820) --- Gemfile | 2 +- Gemfile.lock | 121 +++++++++++++++++++------------------- Podfile.lock | 2 +- changelog.d/pr-1820.build | 1 + 4 files changed, 62 insertions(+), 64 deletions(-) create mode 100644 changelog.d/pr-1820.build diff --git a/Gemfile b/Gemfile index 294361724c..f6e2a0038d 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 c0c6a10288..e66916b798 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/Podfile.lock b/Podfile.lock index 99f9debfc7..69b7a5a515 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -73,4 +73,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e70d3694981265116ff81a851fb0c1c9654995cd -COCOAPODS: 1.11.3 +COCOAPODS: 1.13.0 diff --git a/changelog.d/pr-1820.build b/changelog.d/pr-1820.build new file mode 100644 index 0000000000..09b2100417 --- /dev/null +++ b/changelog.d/pr-1820.build @@ -0,0 +1 @@ +Update Cocoapods to 1.13.0. \ No newline at end of file From 3bed91443a0e8cf7bfe850dde38dc13e5ef99c9b Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Fri, 29 Sep 2023 06:56:23 +0200 Subject: [PATCH 04/11] Fix incorrect @ NSString marker --- MatrixSDK/Data/MXRoom.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index fe1a3a167b..8cfad29c11 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 ?: @"@application/octet-stream"), + @"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 ?: @"@application/octet-stream"); + 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 ?: @"@application/octet-stream"), + @"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 ?: @"@application/octet-stream") + kMXMessageContentKeyExtensibleFileMimeType: (mimeType ?: @"application/octet-stream") }.mutableCopy}.mutableCopy; if(additionalTypes.count) From 0ba502fff7e7a77859a2199089961e8b0a06270f Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 29 Sep 2023 10:34:14 +0300 Subject: [PATCH 05/11] Fix typos following previously merged PR --- MatrixSDK/Data/MXRoom.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index 8cfad29c11..78c9a10c8a 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 ?: @"application/octet-stream"), + @"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 ?: @"application/octet-stream"); + 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 ?: @"application/octet-stream"), + @"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 ?: @"application/octet-stream") + kMXMessageContentKeyExtensibleFileMimeType: (mimetype ?: @"application/octet-stream") }.mutableCopy}.mutableCopy; if(additionalTypes.count) From 2b1e26cd0ba85184e904f691c75606c74ee8783c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 29 Sep 2023 11:41:11 +0300 Subject: [PATCH 06/11] Fix typos following previously merged PR returns --- MatrixSDK/Data/MXRoom.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index 78c9a10c8a..7d88cc2584 100644 --- a/MatrixSDK/Data/MXRoom.m +++ b/MatrixSDK/Data/MXRoom.m @@ -1670,7 +1670,7 @@ - (MXHTTPOperation*)_sendFile:(NSURL*)fileLocalURL kMXMessageBodyKey: filename, @"url": fakeMediaURI, @"info": @{ - @"mimetype": (mimetype ?: @"application/octet-stream"), + @"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 ?: @"application/octet-stream") + kMXMessageContentKeyExtensibleFileMimeType: (mimeType ?: @"application/octet-stream") }.mutableCopy}.mutableCopy; if(additionalTypes.count) From d798299332ce6a06e1cb344e5a72d602bb64fedb Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 29 Sep 2023 09:21:27 +0200 Subject: [PATCH 07/11] Fix QR login support with cryptoV2 --- .../CryptoMachine/MXCryptoMachine.swift | 17 ++++++++ .../CryptoMachine/MXCryptoProtocols.swift | 2 + MatrixSDK/Crypto/MXCryptoV2.swift | 42 ++++++++++++++----- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift b/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift index da4f1ff2f6..8ef5d6fc48 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 has_missing = try machine.queryMissingSecretsFromOtherSessions() + + if (has_missing) { + // Out-of-sync check if there are any secret request to sent 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 2a53e44f4f..b9b4dabc75 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 60fbda52b5..a0134a1bdf 100644 --- a/MatrixSDK/Crypto/MXCryptoV2.swift +++ b/MatrixSDK/Crypto/MXCryptoV2.swift @@ -387,18 +387,39 @@ 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 { + // This method will always fail if the device belongs to someone else. + // XXX Should update API? and remove the userId? + 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) + } } } } @@ -409,6 +430,7 @@ class MXCryptoV2: NSObject, MXCrypto { do { try machine.setLocalTrust(userId: userId, deviceId: deviceId, trust: localTrust) log.debug("Successfully set local trust to \(localTrust)") + // XXX: Why no MainActor.run here? success?() } catch { log.error("Failed setting local trust", context: error) From 9200f84064d191e2def78f7f30a06fdc42255d7c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 2 Oct 2023 13:43:46 +0300 Subject: [PATCH 08/11] Bump the MatrixSDKCrypto to 0.3.13 --- MatrixSDK.podspec | 2 +- Podfile | 2 +- Podfile.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MatrixSDK.podspec b/MatrixSDK.podspec index 971a267ecf..74a1894373 100644 --- a/MatrixSDK.podspec +++ b/MatrixSDK.podspec @@ -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/Podfile b/Podfile index e6c59ed526..f48b15351f 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 69b7a5a515..b816768da1 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.13.0 From 4ce13d21d18a9e43a7d7ece8765935c282f8db38 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 3 Oct 2023 13:15:50 +0300 Subject: [PATCH 09/11] Cleanup --- MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift | 6 +++--- MatrixSDK/Crypto/MXCryptoV2.swift | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift b/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift index 8ef5d6fc48..370cf71aff 100644 --- a/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift +++ b/MatrixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift @@ -615,10 +615,10 @@ extension MXCryptoMachine: MXCryptoCrossSigning { } func queryMissingSecretsFromOtherSessions() async throws { - let has_missing = try machine.queryMissingSecretsFromOtherSessions() + let isMissingSecrets = try machine.queryMissingSecretsFromOtherSessions() - if (has_missing) { - // Out-of-sync check if there are any secret request to sent out as a result of + 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 { diff --git a/MatrixSDK/Crypto/MXCryptoV2.swift b/MatrixSDK/Crypto/MXCryptoV2.swift index a0134a1bdf..2e5c642b7d 100644 --- a/MatrixSDK/Crypto/MXCryptoV2.swift +++ b/MatrixSDK/Crypto/MXCryptoV2.swift @@ -391,11 +391,9 @@ class MXCryptoV2: NSObject, MXCrypto { if (userId == machine.userId) { if (machine.crossSigningStatus().hasSelfSigning) { - // if we can cross sign, upload a new signature for that device + // If we can cross sign, upload a new signature for that device Task { do { - // This method will always fail if the device belongs to someone else. - // XXX Should update API? and remove the userId? try await machine.verifyDevice(userId: userId, deviceId: deviceId) log.debug("Successfully marked device as verified") await MainActor.run { @@ -430,7 +428,6 @@ class MXCryptoV2: NSObject, MXCrypto { do { try machine.setLocalTrust(userId: userId, deviceId: deviceId, trust: localTrust) log.debug("Successfully set local trust to \(localTrust)") - // XXX: Why no MainActor.run here? success?() } catch { log.error("Failed setting local trust", context: error) From 703918b4037691141fa68474faa8253d01b3f100 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 3 Oct 2023 13:35:46 +0300 Subject: [PATCH 10/11] Fix broken MXCrypto stub --- .../Crypto/CryptoMachine/MXCryptoProtocolStubs.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift b/MatrixSDKTests/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift index 8ab364c5b9..171d3b6bab 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 { From 2fef303eafa7e0719bd40684770db826364b0017 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 4 Oct 2023 07:30:57 +0300 Subject: [PATCH 11/11] version++ --- CHANGES.md | 11 +++++++++++ MatrixSDK.podspec | 2 +- MatrixSDK/MatrixSDKVersion.m | 2 +- changelog.d/mimetype.bugfix | 1 - changelog.d/pr-1820.build | 1 - 5 files changed, 13 insertions(+), 4 deletions(-) delete mode 100644 changelog.d/mimetype.bugfix delete mode 100644 changelog.d/pr-1820.build diff --git a/CHANGES.md b/CHANGES.md index 7d361382ee..cc6eb234af 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/MatrixSDK.podspec b/MatrixSDK.podspec index 74a1894373..abcfc24f77 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 diff --git a/MatrixSDK/MatrixSDKVersion.m b/MatrixSDK/MatrixSDKVersion.m index 56bbdf50ee..f52dff1654 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/changelog.d/mimetype.bugfix b/changelog.d/mimetype.bugfix deleted file mode 100644 index e4287e0b86..0000000000 --- a/changelog.d/mimetype.bugfix +++ /dev/null @@ -1 +0,0 @@ -Prevent crash when sending file with unrecognised file extension (no associated mime type) \ No newline at end of file diff --git a/changelog.d/pr-1820.build b/changelog.d/pr-1820.build deleted file mode 100644 index 09b2100417..0000000000 --- a/changelog.d/pr-1820.build +++ /dev/null @@ -1 +0,0 @@ -Update Cocoapods to 1.13.0. \ No newline at end of file