From c7fa15f1d22f8dc8e827db844b1adcbfcf07bc91 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 19 Oct 2022 11:20:11 +0100 Subject: [PATCH 1/5] Hide confirm message as not needed at point of sign in --- .../AuthenticationQRLoginConfirmScreen.swift | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Confirm/View/AuthenticationQRLoginConfirmScreen.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Confirm/View/AuthenticationQRLoginConfirmScreen.swift index b0ddb09067..37d00bdf55 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Confirm/View/AuthenticationQRLoginConfirmScreen.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Confirm/View/AuthenticationQRLoginConfirmScreen.swift @@ -84,16 +84,17 @@ struct AuthenticationQRLoginConfirmScreen: View { /// The screen's footer. var footerContent: some View { VStack(spacing: 16) { - Text(VectorL10n.authenticationQrLoginConfirmAlert) - .padding(10) - .multilineTextAlignment(.center) - .font(theme.fonts.body) - .foregroundColor(theme.colors.alert) - .shapedBorder(color: theme.colors.alert, borderWidth: 1, shape: RoundedRectangle(cornerRadius: 8)) - .fixedSize(horizontal: false, vertical: true) - .padding(.bottom, 12) - .accessibilityIdentifier("alertText") - +// These are only applicable to reciprocating a login via QR which isn't yet implemented: +// +// Text(VectorL10n.authenticationQrLoginConfirmAlert) +// .padding(10) +// .multilineTextAlignment(.center) +// .font(theme.fonts.body) +// .foregroundColor(theme.colors.alert) +// .shapedBorder(color: theme.colors.alert, borderWidth: 1, shape: RoundedRectangle(cornerRadius: 8)) +// .fixedSize(horizontal: false, vertical: true) +// .padding(.bottom, 12) +// .accessibilityIdentifier("alertText") // Button(action: confirm) { // Text(VectorL10n.confirm) // } From e4b4157f3e56a659619a789427cf393853cdaf69 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 19 Oct 2022 11:20:23 +0100 Subject: [PATCH 2/5] Add explicit e2eeSecurityError error type --- .idea/.name | 1 + .idea/Riot.iml | 2 + .idea/misc.xml | 21 +++ .idea/modules.xml | 8 ++ .idea/runConfigurations/CommonKit.xml | 11 ++ .../runConfigurations/CommonKitUnitTests.xml | 7 + .idea/runConfigurations/DesignKit.xml | 11 ++ .idea/runConfigurations/Riot.xml | 11 ++ .idea/runConfigurations/RiotNSE.xml | 11 ++ .../runConfigurations/RiotShareExtension.xml | 11 ++ .idea/runConfigurations/RiotSwiftUI.xml | 11 ++ .idea/runConfigurations/RiotSwiftUITests.xml | 7 + .../runConfigurations/RiotSwiftUnitTests.xml | 7 + .idea/runConfigurations/RiotTests.xml | 7 + .idea/runConfigurations/SiriIntents.xml | 11 ++ .idea/vcs.xml | 6 + .idea/workspace.xml | 131 ++++++++++++++++++ .idea/xcode.xml | 4 + .../Service/MatrixSDK/QRLoginService.swift | 28 ++-- .../Service/QRLoginServiceProtocol.swift | 1 + 20 files changed, 295 insertions(+), 12 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/Riot.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations/CommonKit.xml create mode 100644 .idea/runConfigurations/CommonKitUnitTests.xml create mode 100644 .idea/runConfigurations/DesignKit.xml create mode 100644 .idea/runConfigurations/Riot.xml create mode 100644 .idea/runConfigurations/RiotNSE.xml create mode 100644 .idea/runConfigurations/RiotShareExtension.xml create mode 100644 .idea/runConfigurations/RiotSwiftUI.xml create mode 100644 .idea/runConfigurations/RiotSwiftUITests.xml create mode 100644 .idea/runConfigurations/RiotSwiftUnitTests.xml create mode 100644 .idea/runConfigurations/RiotTests.xml create mode 100644 .idea/runConfigurations/SiriIntents.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 .idea/xcode.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000..b42fc24be9 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Riot \ No newline at end of file diff --git a/.idea/Riot.iml b/.idea/Riot.iml new file mode 100644 index 0000000000..d72796fdcd --- /dev/null +++ b/.idea/Riot.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..8a8ce1f6ae --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..674fe27f73 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/CommonKit.xml b/.idea/runConfigurations/CommonKit.xml new file mode 100644 index 0000000000..bef34ea96e --- /dev/null +++ b/.idea/runConfigurations/CommonKit.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/CommonKitUnitTests.xml b/.idea/runConfigurations/CommonKitUnitTests.xml new file mode 100644 index 0000000000..4679641b66 --- /dev/null +++ b/.idea/runConfigurations/CommonKitUnitTests.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/DesignKit.xml b/.idea/runConfigurations/DesignKit.xml new file mode 100644 index 0000000000..bf0d9024b8 --- /dev/null +++ b/.idea/runConfigurations/DesignKit.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Riot.xml b/.idea/runConfigurations/Riot.xml new file mode 100644 index 0000000000..d61a94861f --- /dev/null +++ b/.idea/runConfigurations/Riot.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotNSE.xml b/.idea/runConfigurations/RiotNSE.xml new file mode 100644 index 0000000000..3d06f3edc9 --- /dev/null +++ b/.idea/runConfigurations/RiotNSE.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotShareExtension.xml b/.idea/runConfigurations/RiotShareExtension.xml new file mode 100644 index 0000000000..dbb9f18391 --- /dev/null +++ b/.idea/runConfigurations/RiotShareExtension.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUI.xml b/.idea/runConfigurations/RiotSwiftUI.xml new file mode 100644 index 0000000000..94c244e47d --- /dev/null +++ b/.idea/runConfigurations/RiotSwiftUI.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUITests.xml b/.idea/runConfigurations/RiotSwiftUITests.xml new file mode 100644 index 0000000000..daa9bc6530 --- /dev/null +++ b/.idea/runConfigurations/RiotSwiftUITests.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUnitTests.xml b/.idea/runConfigurations/RiotSwiftUnitTests.xml new file mode 100644 index 0000000000..89f0d30de7 --- /dev/null +++ b/.idea/runConfigurations/RiotSwiftUnitTests.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RiotTests.xml b/.idea/runConfigurations/RiotTests.xml new file mode 100644 index 0000000000..9211fe4aae --- /dev/null +++ b/.idea/runConfigurations/RiotTests.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/SiriIntents.xml b/.idea/runConfigurations/SiriIntents.xml new file mode 100644 index 0000000000..e137daf453 --- /dev/null +++ b/.idea/runConfigurations/SiriIntents.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..e87380828f --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "keyToString": { + "OBJC.PRESERVED_TARGET_SELECTION": "CommonKit", + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.cidr.known.project.marker": "true", + "WebServerToolWindowFactoryState": "false", + "cidr.known.project.marker": "true", + "last_opened_file_path": "/Users/element/GitHub/vector-im/element-ios/Riot.xcodeproj", + "nodejs_package_manager_path": "npm", + "settings.editor.selected.configurable": "preferences.lookFeel" + } +} + + + + + + + + + + + + + + + + + + + + 1665578673532 + + + + + + + + + \ No newline at end of file diff --git a/.idea/xcode.xml b/.idea/xcode.xml new file mode 100644 index 0000000000..e5e8b3ef31 --- /dev/null +++ b/.idea/xcode.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift index 0dc3f78d57..7a9f881a97 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift @@ -288,14 +288,23 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { await teardownRendezvous(state: .failed(error: .rendezvousFailed)) return } - + + // check that device key from verifier matches the one received from the homeserver + guard let verifyingDeviceInfo = session.crypto.device(withDeviceId: verifiyingDeviceId, ofUser: session.myUserId), + verifyingDeviceInfo.fingerprint == verifyingDeviceKey else { + MXLog.error("[QRLoginService] Received invalid verifying device info") + await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) + return + } + MXLog.debug("[QRLoginService] Received cross-signing details \(responsePayload)") - + if let masterKeyFromVerifyingDevice = responsePayload.masterKey, let localMasterKey = session.crypto.crossSigningKeys(forUser: session.myUserId).masterKeys?.keys { + // if master key was received from verifier then check that it matches the one from the homeserver guard masterKeyFromVerifyingDevice == localMasterKey else { MXLog.error("[QRLoginService] Received invalid master key from verifying device") - await teardownRendezvous(state: .failed(error: .rendezvousFailed)) + await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } @@ -311,18 +320,13 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { guard mskVerificationResult == true else { MXLog.error("[QRLoginService] Failed marking the master key as trusted") - await teardownRendezvous(state: .failed(error: .rendezvousFailed)) + await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } } - - guard let verifyingDeviceInfo = session.crypto.device(withDeviceId: verifiyingDeviceId, ofUser: session.myUserId), - verifyingDeviceInfo.fingerprint == verifyingDeviceKey else { - MXLog.error("[QRLoginService] Received invalid verifying device info") - await teardownRendezvous(state: .failed(error: .rendezvousFailed)) - return - } - + + // we only mark the verifying device as trusted if the device key matches and the master key matches (or the + // master key was not sent) MXLog.debug("[QRLoginService] Locally marking the existing device as verified \(verifyingDeviceInfo)") await withCheckedContinuation { (continuation: CheckedContinuation) in session.crypto.setDeviceVerification(.verified, forDevice: verifiyingDeviceId, ofUser: session.myUserId) { diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/QRLoginServiceProtocol.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/QRLoginServiceProtocol.swift index 823a4983c2..b7c4968be1 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/QRLoginServiceProtocol.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/QRLoginServiceProtocol.swift @@ -34,6 +34,7 @@ enum QRLoginServiceError: Error, Equatable { case requestDenied case requestTimedOut case rendezvousFailed + case e2eeSecurityError } // MARK: - QRLoginServiceState From b1177fd02cb925ddd53fde28ba9939622555e49f Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 19 Oct 2022 11:27:44 +0100 Subject: [PATCH 3/5] Inform other part of e2ee security issue --- .idea/workspace.xml | 24 +++---------------- .../QRLogin/Common/Models/QRLoginCode.swift | 1 + .../Service/MatrixSDK/QRLoginService.swift | 10 ++++++++ 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e87380828f..bad3e89e0f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,30 +5,12 @@ - - - - - - - - - - - - - - - - - - + + - - diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Models/QRLoginCode.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Models/QRLoginCode.swift index b6bae67577..d7b82b6a15 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Models/QRLoginCode.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Models/QRLoginCode.swift @@ -91,6 +91,7 @@ struct QRLoginRendezvousPayload: Codable { case success case declined case verified + case e2eeSecurityError = "e2ee_security_error" } // swiftformat:disable:next redundantBackticks diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift index 7a9f881a97..107a2c49f2 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift @@ -293,6 +293,11 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { guard let verifyingDeviceInfo = session.crypto.device(withDeviceId: verifiyingDeviceId, ofUser: session.myUserId), verifyingDeviceInfo.fingerprint == verifyingDeviceKey else { MXLog.error("[QRLoginService] Received invalid verifying device info") + // inform other party of potential E2EE issue: + guard let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)), + case .success = await rendezvousService.send(data: requestData) else { + // we don't mind if we couldn't inform the other party + } await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } @@ -304,6 +309,11 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { // if master key was received from verifier then check that it matches the one from the homeserver guard masterKeyFromVerifyingDevice == localMasterKey else { MXLog.error("[QRLoginService] Received invalid master key from verifying device") + // inform other party of potential E2EE issue: + guard let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)), + case .success = await rendezvousService.send(data: requestData) else { + // we don't mind if we couldn't inform the other party + } await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } From 6c093ad4edf6a6f42f8de826b2631962b0155e55 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 19 Oct 2022 11:33:14 +0100 Subject: [PATCH 4/5] Remove unintentional commits --- .idea/.name | 1 - .idea/Riot.iml | 2 - .idea/misc.xml | 21 ---- .idea/modules.xml | 8 -- .idea/runConfigurations/CommonKit.xml | 11 -- .../runConfigurations/CommonKitUnitTests.xml | 7 -- .idea/runConfigurations/DesignKit.xml | 11 -- .idea/runConfigurations/Riot.xml | 11 -- .idea/runConfigurations/RiotNSE.xml | 11 -- .../runConfigurations/RiotShareExtension.xml | 11 -- .idea/runConfigurations/RiotSwiftUI.xml | 11 -- .idea/runConfigurations/RiotSwiftUITests.xml | 7 -- .../runConfigurations/RiotSwiftUnitTests.xml | 7 -- .idea/runConfigurations/RiotTests.xml | 7 -- .idea/runConfigurations/SiriIntents.xml | 11 -- .idea/vcs.xml | 6 - .idea/workspace.xml | 113 ------------------ .idea/xcode.xml | 4 - 18 files changed, 260 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/Riot.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/runConfigurations/CommonKit.xml delete mode 100644 .idea/runConfigurations/CommonKitUnitTests.xml delete mode 100644 .idea/runConfigurations/DesignKit.xml delete mode 100644 .idea/runConfigurations/Riot.xml delete mode 100644 .idea/runConfigurations/RiotNSE.xml delete mode 100644 .idea/runConfigurations/RiotShareExtension.xml delete mode 100644 .idea/runConfigurations/RiotSwiftUI.xml delete mode 100644 .idea/runConfigurations/RiotSwiftUITests.xml delete mode 100644 .idea/runConfigurations/RiotSwiftUnitTests.xml delete mode 100644 .idea/runConfigurations/RiotTests.xml delete mode 100644 .idea/runConfigurations/SiriIntents.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml delete mode 100644 .idea/xcode.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index b42fc24be9..0000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Riot \ No newline at end of file diff --git a/.idea/Riot.iml b/.idea/Riot.iml deleted file mode 100644 index d72796fdcd..0000000000 --- a/.idea/Riot.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 8a8ce1f6ae..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 674fe27f73..0000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/CommonKit.xml b/.idea/runConfigurations/CommonKit.xml deleted file mode 100644 index bef34ea96e..0000000000 --- a/.idea/runConfigurations/CommonKit.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/CommonKitUnitTests.xml b/.idea/runConfigurations/CommonKitUnitTests.xml deleted file mode 100644 index 4679641b66..0000000000 --- a/.idea/runConfigurations/CommonKitUnitTests.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/DesignKit.xml b/.idea/runConfigurations/DesignKit.xml deleted file mode 100644 index bf0d9024b8..0000000000 --- a/.idea/runConfigurations/DesignKit.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/Riot.xml b/.idea/runConfigurations/Riot.xml deleted file mode 100644 index d61a94861f..0000000000 --- a/.idea/runConfigurations/Riot.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotNSE.xml b/.idea/runConfigurations/RiotNSE.xml deleted file mode 100644 index 3d06f3edc9..0000000000 --- a/.idea/runConfigurations/RiotNSE.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotShareExtension.xml b/.idea/runConfigurations/RiotShareExtension.xml deleted file mode 100644 index dbb9f18391..0000000000 --- a/.idea/runConfigurations/RiotShareExtension.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUI.xml b/.idea/runConfigurations/RiotSwiftUI.xml deleted file mode 100644 index 94c244e47d..0000000000 --- a/.idea/runConfigurations/RiotSwiftUI.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUITests.xml b/.idea/runConfigurations/RiotSwiftUITests.xml deleted file mode 100644 index daa9bc6530..0000000000 --- a/.idea/runConfigurations/RiotSwiftUITests.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotSwiftUnitTests.xml b/.idea/runConfigurations/RiotSwiftUnitTests.xml deleted file mode 100644 index 89f0d30de7..0000000000 --- a/.idea/runConfigurations/RiotSwiftUnitTests.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/RiotTests.xml b/.idea/runConfigurations/RiotTests.xml deleted file mode 100644 index 9211fe4aae..0000000000 --- a/.idea/runConfigurations/RiotTests.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/SiriIntents.xml b/.idea/runConfigurations/SiriIntents.xml deleted file mode 100644 index e137daf453..0000000000 --- a/.idea/runConfigurations/SiriIntents.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4c..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index bad3e89e0f..0000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "keyToString": { - "OBJC.PRESERVED_TARGET_SELECTION": "CommonKit", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "RunOnceActivity.cidr.known.project.marker": "true", - "WebServerToolWindowFactoryState": "false", - "cidr.known.project.marker": "true", - "last_opened_file_path": "/Users/element/GitHub/vector-im/element-ios/Riot.xcodeproj", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "preferences.lookFeel" - } -} - - - - - - - - - - - - - - - - - - - - 1665578673532 - - - - - - - - - \ No newline at end of file diff --git a/.idea/xcode.xml b/.idea/xcode.xml deleted file mode 100644 index e5e8b3ef31..0000000000 --- a/.idea/xcode.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From 0ab35f273ea140cc179660dbb5c9a3722c1bad97 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 19 Oct 2022 14:41:47 +0300 Subject: [PATCH 5/5] Add e2e security error copy --- Riot/Assets/en.lproj/Vector.strings | 1 + Riot/Generated/Strings.swift | 4 ++++ .../Service/MatrixSDK/QRLoginService.swift | 24 ++++++++++--------- ...uthenticationQRLoginFailureViewModel.swift | 3 +++ 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 025415be39..c3c4a890f7 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -241,6 +241,7 @@ "authentication_qr_login_failure_invalid_qr" = "QR code is invalid."; "authentication_qr_login_failure_request_denied" = "The request was denied on the other device."; "authentication_qr_login_failure_request_timed_out" = "The linking wasn’t completed in the required time."; +"authentication_qr_login_failure_e2ee_security_error" = "A security issue was encountered setting up secure messaging. One of the following may be compromised: Your homeserver; Your internet connection(s); Your device(s);"; "authentication_qr_login_failure_retry" = "Try again"; // MARK: Password Validation diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 7671c5c732..adee5b0c75 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -771,6 +771,10 @@ public class VectorL10n: NSObject { public static var authenticationQrLoginDisplayTitle: String { return VectorL10n.tr("Vector", "authentication_qr_login_display_title") } + /// A security issue was encountered setting up secure messaging. One of the following may be compromised: Your homeserver; Your internet connection(s); Your device(s); + public static var authenticationQrLoginFailureE2eeSecurityError: String { + return VectorL10n.tr("Vector", "authentication_qr_login_failure_e2ee_security_error") + } /// QR code is invalid. public static var authenticationQrLoginFailureInvalidQr: String { return VectorL10n.tr("Vector", "authentication_qr_login_failure_invalid_qr") diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift index 107a2c49f2..17467666af 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift @@ -288,32 +288,34 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { await teardownRendezvous(state: .failed(error: .rendezvousFailed)) return } - + // check that device key from verifier matches the one received from the homeserver guard let verifyingDeviceInfo = session.crypto.device(withDeviceId: verifiyingDeviceId, ofUser: session.myUserId), verifyingDeviceInfo.fingerprint == verifyingDeviceKey else { MXLog.error("[QRLoginService] Received invalid verifying device info") - // inform other party of potential E2EE issue: - guard let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)), - case .success = await rendezvousService.send(data: requestData) else { - // we don't mind if we couldn't inform the other party + + // try informing the other party of a potential E2EE issue + if let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)) { + _ = await rendezvousService.send(data: requestData) } + await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } - + MXLog.debug("[QRLoginService] Received cross-signing details \(responsePayload)") - + if let masterKeyFromVerifyingDevice = responsePayload.masterKey, let localMasterKey = session.crypto.crossSigningKeys(forUser: session.myUserId).masterKeys?.keys { // if master key was received from verifier then check that it matches the one from the homeserver guard masterKeyFromVerifyingDevice == localMasterKey else { MXLog.error("[QRLoginService] Received invalid master key from verifying device") - // inform other party of potential E2EE issue: - guard let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)), - case .success = await rendezvousService.send(data: requestData) else { - // we don't mind if we couldn't inform the other party + + // try informing the other party of a potential E2EE issue + if let requestData = try? JSONEncoder().encode(QRLoginRendezvousPayload(type: .loginFinish, outcome: .e2eeSecurityError)) { + _ = await rendezvousService.send(data: requestData) } + await teardownRendezvous(state: .failed(error: .e2eeSecurityError)) return } diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Failure/AuthenticationQRLoginFailureViewModel.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Failure/AuthenticationQRLoginFailureViewModel.swift index 0e363e5492..f3c3e7113c 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Failure/AuthenticationQRLoginFailureViewModel.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Failure/AuthenticationQRLoginFailureViewModel.swift @@ -61,6 +61,9 @@ class AuthenticationQRLoginFailureViewModel: AuthenticationQRLoginFailureViewMod case .requestTimedOut: self.state.failureText = VectorL10n.authenticationQrLoginFailureRequestTimedOut self.state.retryButtonVisible = true + case .e2eeSecurityError: + self.state.failureText = VectorL10n.authenticationQrLoginFailureE2eeSecurityError + self.state.retryButtonVisible = true default: break }