From 3618ad9153ed22add872ba742c6f14ebc44c2966 Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Mon, 27 Mar 2023 13:25:35 +0100 Subject: [PATCH 1/4] Display upgrade verification prompt --- Riot/Assets/en.lproj/Vector.strings | 5 +++++ Riot/Experiments/CryptoSDKFeature.swift | 20 ++++++++++++++++++- Riot/Generated/Strings.swift | 8 ++++++++ Riot/Managers/Settings/RiotSettings.swift | 3 +++ .../AllChats/AllChatsViewController.swift | 18 +++++++++++++++-- changelog.d/pr-7454.change | 1 + 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 changelog.d/pr-7454.change diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 8a9f712c3..9c929a9cf 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -1560,6 +1560,11 @@ Tap the + to start adding people."; "key_verification_self_verify_current_session_alert_message" = "Other users may not trust it."; "key_verification_self_verify_current_session_alert_validate_action" = "Verify"; +// Legacy to Rust security upgrade + +"key_verification_self_verify_security_upgrade_alert_title" = "Encryption upgraded"; +"key_verification_self_verify_security_upgrade_alert_message" = "The end-to-end encryption has been upgraded to be more secure. Please re-verify your account."; + // Unverified sessions "key_verification_alert_title" = "You have unverified sessions"; "key_verification_alert_body" = "Review to ensure your account is safe."; diff --git a/Riot/Experiments/CryptoSDKFeature.swift b/Riot/Experiments/CryptoSDKFeature.swift index 96c743951..8404675c2 100644 --- a/Riot/Experiments/CryptoSDKFeature.swift +++ b/Riot/Experiments/CryptoSDKFeature.swift @@ -40,7 +40,18 @@ import MatrixSDKCrypto RiotSettings.shared.enableCryptoSDK } + var needsVerificationUpgrade: Bool { + get { + return RiotSettings.shared.showVerificationUpgradeAlert + } + set { + RiotSettings.shared.showVerificationUpgradeAlert = newValue + } + } + private static let FeatureName = "ios-crypto-sdk" + private static let FeatureNameV2 = "ios-crypto-sdk-v2" + private let remoteFeature: RemoteFeaturesClientProtocol private let localFeature: PhasedRolloutFeature @@ -98,6 +109,13 @@ import MatrixSDKCrypto } private func isFeatureEnabled(userId: String) -> Bool { - remoteFeature.isFeatureEnabled(Self.FeatureName) || localFeature.isEnabled(userId: userId) + // This feature includes app version with a bug, and thus will not be rolled out to 100% users + remoteFeature.isFeatureEnabled(Self.FeatureName) + + // Second version of the remote feature with a bugfix and released eventually to 100% users + || remoteFeature.isFeatureEnabled(Self.FeatureNameV2) + + // Local feature + || localFeature.isEnabled(userId: userId) } } diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index b31ee8596..365fe90ef 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -3027,6 +3027,14 @@ public class VectorL10n: NSObject { public static var keyVerificationSelfVerifyCurrentSessionAlertValidateAction: String { return VectorL10n.tr("Vector", "key_verification_self_verify_current_session_alert_validate_action") } + /// Your end-to-end encryption algorithms have been upgraded to be more secure. Please re-verify your account. + public static var keyVerificationSelfVerifySecurityUpgradeAlertMessage: String { + return VectorL10n.tr("Vector", "key_verification_self_verify_security_upgrade_alert_message") + } + /// Encryption upgraded + public static var keyVerificationSelfVerifySecurityUpgradeAlertTitle: String { + return VectorL10n.tr("Vector", "key_verification_self_verify_security_upgrade_alert_title") + } /// Review public static var keyVerificationSelfVerifyUnverifiedSessionsAlertValidateAction: String { return VectorL10n.tr("Vector", "key_verification_self_verify_unverified_sessions_alert_validate_action") diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index efb9a8e1c..06746801c 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -211,6 +211,9 @@ final class RiotSettings: NSObject { @UserDefault(key: "hideVerifyThisSessionAlert", defaultValue: false, storage: defaults) var hideVerifyThisSessionAlert + @UserDefault(key: "showVerificationUpgradeAlert", defaultValue: false, storage: defaults) + var showVerificationUpgradeAlert + @UserDefault(key: "matrixApps", defaultValue: false, storage: defaults) var matrixApps diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 1c72df342..3c5d194d3 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -985,8 +985,22 @@ extension AllChatsViewController: SplitViewMasterViewControllerProtocol { private func presentVerifyCurrentSessionAlert(with session: MXSession) { MXLog.debug("[AllChatsViewController] presentVerifyCurrentSessionAlertWithSession") - let alert = UIAlertController(title: VectorL10n.keyVerificationSelfVerifyCurrentSessionAlertTitle, - message: VectorL10n.keyVerificationSelfVerifyCurrentSessionAlertMessage, + let title: String + let message: String + + if + let feature = MXSDKOptions.sharedInstance().cryptoSDKFeature, + feature.isEnabled && feature.needsVerificationUpgrade + { + title = VectorL10n.keyVerificationSelfVerifySecurityUpgradeAlertTitle + message = VectorL10n.keyVerificationSelfVerifySecurityUpgradeAlertMessage + } else { + title = VectorL10n.keyVerificationSelfVerifyCurrentSessionAlertTitle + message = VectorL10n.keyVerificationSelfVerifyCurrentSessionAlertMessage + } + + let alert = UIAlertController(title: title, + message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: VectorL10n.keyVerificationSelfVerifyCurrentSessionAlertValidateAction, diff --git a/changelog.d/pr-7454.change b/changelog.d/pr-7454.change new file mode 100644 index 000000000..de71f8f8d --- /dev/null +++ b/changelog.d/pr-7454.change @@ -0,0 +1 @@ +Verification: Display upgrade verification prompt From be14fc3e0dae84853e461576d54b732054d03fd1 Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Tue, 28 Mar 2023 14:24:54 +0100 Subject: [PATCH 2/4] Update copy --- Riot/Assets/en.lproj/Vector.strings | 4 ++-- Riot/Generated/Strings.swift | 4 ++-- Riot/Modules/Home/AllChats/AllChatsViewController.swift | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 9c929a9cf..5b98db946 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -1562,8 +1562,8 @@ Tap the + to start adding people."; // Legacy to Rust security upgrade -"key_verification_self_verify_security_upgrade_alert_title" = "Encryption upgraded"; -"key_verification_self_verify_security_upgrade_alert_message" = "The end-to-end encryption has been upgraded to be more secure. Please re-verify your account."; +"key_verification_self_verify_security_upgrade_alert_title" = "App updated"; +"key_verification_self_verify_security_upgrade_alert_message" = "Secure messaging has been improved with the latest update. Please re-verify your device."; // Unverified sessions "key_verification_alert_title" = "You have unverified sessions"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 365fe90ef..3cde53fe9 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -3027,11 +3027,11 @@ public class VectorL10n: NSObject { public static var keyVerificationSelfVerifyCurrentSessionAlertValidateAction: String { return VectorL10n.tr("Vector", "key_verification_self_verify_current_session_alert_validate_action") } - /// Your end-to-end encryption algorithms have been upgraded to be more secure. Please re-verify your account. + /// Secure messaging has been improved with the latest update. Please re-verify your device. public static var keyVerificationSelfVerifySecurityUpgradeAlertMessage: String { return VectorL10n.tr("Vector", "key_verification_self_verify_security_upgrade_alert_message") } - /// Encryption upgraded + /// App updated public static var keyVerificationSelfVerifySecurityUpgradeAlertTitle: String { return VectorL10n.tr("Vector", "key_verification_self_verify_security_upgrade_alert_title") } diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 3c5d194d3..ea96873ba 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -988,10 +988,8 @@ extension AllChatsViewController: SplitViewMasterViewControllerProtocol { let title: String let message: String - if - let feature = MXSDKOptions.sharedInstance().cryptoSDKFeature, - feature.isEnabled && feature.needsVerificationUpgrade - { + if let feature = MXSDKOptions.sharedInstance().cryptoSDKFeature, + feature.isEnabled && feature.needsVerificationUpgrade { title = VectorL10n.keyVerificationSelfVerifySecurityUpgradeAlertTitle message = VectorL10n.keyVerificationSelfVerifySecurityUpgradeAlertMessage } else { From f697abacd70599ea8acf2081fb42764a593abf8d Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Tue, 28 Mar 2023 16:54:37 +0100 Subject: [PATCH 3/4] changelog.d: Upgrade MatrixSDK version ([v0.26.5](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.26.5)). --- Config/AppVersion.xcconfig | 4 ++-- Podfile | 2 +- changelog.d/x-nolink-0.change | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/x-nolink-0.change diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index 698eeaa2b..4b4e48563 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 1.10.7 -CURRENT_PROJECT_VERSION = 1.10.7 +MARKETING_VERSION = 1.10.8 +CURRENT_PROJECT_VERSION = 1.10.8 diff --git a/Podfile b/Podfile index d7a2bb7ac..cfdc001b2 100644 --- a/Podfile +++ b/Podfile @@ -16,7 +16,7 @@ use_frameworks! # - `{ :specHash => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for MatrixSDK repo. Used by Fastfile during CI # # Warning: our internal tooling depends on the name of this variable name, so be sure not to change it -$matrixSDKVersion = '= 0.26.4' +$matrixSDKVersion = '= 0.26.5' # $matrixSDKVersion = :local # $matrixSDKVersion = { :branch => 'develop'} # $matrixSDKVersion = { :specHash => { git: 'https://git.io/fork123', branch: 'fix' } } diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change new file mode 100644 index 000000000..49db1b45e --- /dev/null +++ b/changelog.d/x-nolink-0.change @@ -0,0 +1 @@ +Upgrade MatrixSDK version ([v0.26.5](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.26.5)). \ No newline at end of file From 6a1047cf2c68237821d968af3e8f993620533d44 Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Tue, 28 Mar 2023 16:54:37 +0100 Subject: [PATCH 4/4] version++ --- CHANGES.md | 8 ++++++++ changelog.d/pr-7454.change | 1 - changelog.d/x-nolink-0.change | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/pr-7454.change delete mode 100644 changelog.d/x-nolink-0.change diff --git a/CHANGES.md b/CHANGES.md index d646ee3ca..890db41aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +## Changes in 1.10.8 (2023-03-28) + +🙌 Improvements + +- Verification: Display upgrade verification prompt ([#7454](https://github.com/vector-im/element-ios/pull/7454)) +- Upgrade MatrixSDK version ([v0.26.5](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.26.5)). + + ## Changes in 1.10.7 (2023-03-22) 🙌 Improvements diff --git a/changelog.d/pr-7454.change b/changelog.d/pr-7454.change deleted file mode 100644 index de71f8f8d..000000000 --- a/changelog.d/pr-7454.change +++ /dev/null @@ -1 +0,0 @@ -Verification: Display upgrade verification prompt diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change deleted file mode 100644 index 49db1b45e..000000000 --- a/changelog.d/x-nolink-0.change +++ /dev/null @@ -1 +0,0 @@ -Upgrade MatrixSDK version ([v0.26.5](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.26.5)). \ No newline at end of file