From 8f6192c2b6cbd225534682c77f042c153443172d Mon Sep 17 00:00:00 2001 From: Davide Date: Fri, 11 Oct 2024 03:45:20 +0200 Subject: [PATCH] Fix extra team prefix in keychain group (#721) Team ID already included in .xcconfig Fixes #720 --- .../xcshareddata/swiftpm/Package.resolved | 2 +- Passepartout/App/App.entitlements | 3 ++- Passepartout/App/App.plist | 2 +- Passepartout/Config.xcconfig | 1 + Passepartout/Intents/Intents.plist | 4 ---- Passepartout/Library/Package.swift | 2 +- .../Sources/AppLibrary/Business/NEProfileRepository.swift | 7 ++++++- Passepartout/Library/Sources/AppUI/AppUI.swift | 5 +++++ Passepartout/Tunnel/Tunnel.entitlements | 2 +- Passepartout/Tunnel/Tunnel.plist | 2 +- 10 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 87851223..d5440d4d 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "c859acb74cb50f7ad218265cd3d3eb0eb99ee1c5" + "revision" : "de9387965025a1f79e060e6bdc862933fe972598" } }, { diff --git a/Passepartout/App/App.entitlements b/Passepartout/App/App.entitlements index 3beadaec..03d111e0 100644 --- a/Passepartout/App/App.entitlements +++ b/Passepartout/App/App.entitlements @@ -37,7 +37,8 @@ keychain-access-groups - $(AppIdentifierPrefix)$(CFG_GROUP_ID) + $(CFG_KEYCHAIN_GROUP_ID) + $(AppIdentifierPrefix)$(CFG_KEYCHAIN_GROUP_ID) diff --git a/Passepartout/App/App.plist b/Passepartout/App/App.plist index 2beab1b6..85e304cd 100644 --- a/Passepartout/App/App.plist +++ b/Passepartout/App/App.plist @@ -13,7 +13,7 @@ iapBundlePrefix $(CFG_IAP_BUNDLE_PREFIX) keychainGroupId - $(CFG_TEAM_ID).$(CFG_GROUP_ID) + $(CFG_KEYCHAIN_GROUP_ID) tunnelId $(CFG_TUNNEL_ID) legacyV2CloudKitId diff --git a/Passepartout/Config.xcconfig b/Passepartout/Config.xcconfig index f0153ec0..9a6bc98a 100644 --- a/Passepartout/Config.xcconfig +++ b/Passepartout/Config.xcconfig @@ -36,6 +36,7 @@ CFG_GROUP_ID[sdk=appletvsimulator*] = $(CFG_RAW_GROUP_ID) CFG_GROUP_ID[sdk=iphoneos*] = $(CFG_RAW_GROUP_ID) CFG_GROUP_ID[sdk=iphonesimulator*] = $(CFG_RAW_GROUP_ID) CFG_GROUP_ID[sdk=macosx*] = $(CFG_TEAM_ID).$(CFG_RAW_GROUP_ID) +CFG_KEYCHAIN_GROUP_ID = $(CFG_TEAM_ID).$(CFG_RAW_GROUP_ID) CFG_IAP_BUNDLE_PREFIX = com.algoritmico.ios.Passepartout CFG_INTENTS_ID = $(CFG_APP_ID).Intents CFG_RAW_GROUP_ID = group.com.algoritmico.Passepartout diff --git a/Passepartout/Intents/Intents.plist b/Passepartout/Intents/Intents.plist index d94c5250..c0f716ad 100644 --- a/Passepartout/Intents/Intents.plist +++ b/Passepartout/Intents/Intents.plist @@ -8,10 +8,6 @@ $(CFG_APP_ID) groupId $(CFG_GROUP_ID) - keychainGroupId - $(CFG_TEAM_ID).$(CFG_GROUP_ID) - teamId - $(CFG_TEAM_ID) tunnelId $(CFG_TUNNEL_ID) diff --git a/Passepartout/Library/Package.swift b/Passepartout/Library/Package.swift index 9c53fffe..cc85133e 100644 --- a/Passepartout/Library/Package.swift +++ b/Passepartout/Library/Package.swift @@ -28,7 +28,7 @@ let package = Package( ], dependencies: [ // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.8.0"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "c859acb74cb50f7ad218265cd3d3eb0eb99ee1c5"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "de9387965025a1f79e060e6bdc862933fe972598"), // .package(path: "../../../passepartoutkit-source"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.8.0"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), diff --git a/Passepartout/Library/Sources/AppLibrary/Business/NEProfileRepository.swift b/Passepartout/Library/Sources/AppLibrary/Business/NEProfileRepository.swift index a9e71764..47427be0 100644 --- a/Passepartout/Library/Sources/AppLibrary/Business/NEProfileRepository.swift +++ b/Passepartout/Library/Sources/AppLibrary/Business/NEProfileRepository.swift @@ -46,7 +46,12 @@ public final class NEProfileRepository: ProfileRepository { .managersPublisher .sink { [weak self] allManagers in let profiles = allManagers.values.compactMap { - try? repository.profile(from: $0) + do { + return try repository.profile(from: $0) + } catch { + pp_log(.app, .error, "Unable to decode profile from NE manager '\($0.localizedDescription ?? "")': \(error)") + return nil + } } self?.profilesSubject.send(profiles) } diff --git a/Passepartout/Library/Sources/AppUI/AppUI.swift b/Passepartout/Library/Sources/AppUI/AppUI.swift index d511203a..274c60da 100644 --- a/Passepartout/Library/Sources/AppUI/AppUI.swift +++ b/Passepartout/Library/Sources/AppUI/AppUI.swift @@ -24,11 +24,13 @@ // import Foundation +import NetworkExtension import PassepartoutKit public enum AppUI { public static func configure(with context: AppContext) { assertMissingModuleImplementations() + cleanUpOrphanedKeychainEntries() } } @@ -44,4 +46,7 @@ private extension AppUI { } } } + + static func cleanUpOrphanedKeychainEntries() { + } } diff --git a/Passepartout/Tunnel/Tunnel.entitlements b/Passepartout/Tunnel/Tunnel.entitlements index 1e8c0899..c1217f54 100644 --- a/Passepartout/Tunnel/Tunnel.entitlements +++ b/Passepartout/Tunnel/Tunnel.entitlements @@ -18,7 +18,7 @@ keychain-access-groups - $(AppIdentifierPrefix)$(CFG_GROUP_ID) + $(CFG_KEYCHAIN_GROUP_ID) diff --git a/Passepartout/Tunnel/Tunnel.plist b/Passepartout/Tunnel/Tunnel.plist index 77958724..db76be5d 100644 --- a/Passepartout/Tunnel/Tunnel.plist +++ b/Passepartout/Tunnel/Tunnel.plist @@ -7,7 +7,7 @@ groupId $(CFG_GROUP_ID) keychainGroupId - $(CFG_TEAM_ID).$(CFG_GROUP_ID) + $(CFG_KEYCHAIN_GROUP_ID) tunnelId $(CFG_TUNNEL_ID)