From ab05170a00a13703997d83bb004c33c6caea4f4e Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Thu, 6 Feb 2025 15:31:27 +0000 Subject: [PATCH 1/8] Add new empty PIR package to aid migration (#3835) Task/Issue URL: https://app.asana.com/0/1187352151074490/1209334604294772 Tech Design URL: CC: **Description**: Adds an empty and inert package for now to aid migration. See TD for details **Optional E2E tests**: - [x] Run PIR E2E tests Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this. **Steps to test this PR**: 1. Test macOS still compiles and runs **Definition of Done**: * [x] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --------- Co-authored-by: Pete Smith <5278441+aataraxiaa@users.noreply.github.com> --- DuckDuckGo-macOS.xcodeproj/project.pbxproj | 2 + .../DataBrokerProtection/Package.swift | 2 + .../contents.xcworkspacedata | 7 ++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../xcschemes/macOS PIR Tests.xcscheme | 53 ++++++++++++++ .../DataBrokerProtectionShared/Package.swift | 70 +++++++++++++++++++ .../DataBrokerProtectionBlank.swift | 19 +++++ .../Tests/.swiftlint.yml | 17 +++++ .../DataBrokerProtectionBlankTests.swift | 19 +++++ 9 files changed, 197 insertions(+) create mode 100644 LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/xcshareddata/xcschemes/macOS PIR Tests.xcscheme create mode 100644 LocalPackages/DataBrokerProtectionShared/Package.swift create mode 100644 LocalPackages/DataBrokerProtectionShared/Sources/DataBrokerProtectionShared/DataBrokerProtectionBlank.swift create mode 100644 LocalPackages/DataBrokerProtectionShared/Tests/.swiftlint.yml create mode 100644 LocalPackages/DataBrokerProtectionShared/Tests/DataBrokerProtectionSharedTests/DataBrokerProtectionBlankTests.swift diff --git a/DuckDuckGo-macOS.xcodeproj/project.pbxproj b/DuckDuckGo-macOS.xcodeproj/project.pbxproj index b3ee835263..cc020075fb 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.pbxproj +++ b/DuckDuckGo-macOS.xcodeproj/project.pbxproj @@ -4469,6 +4469,7 @@ 9D84E3F42CD4E6660046CD8B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 9D84E43C2CD4E66F0046CD8B /* DBPE2ETests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DBPE2ETests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9D8FA00B2AC5BDCE005DD0D0 /* LoginItem+DataBrokerProtection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LoginItem+DataBrokerProtection.swift"; sourceTree = ""; }; + 9D9150F32D53F1F1005B5833 /* DataBrokerProtectionShared */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = DataBrokerProtectionShared; sourceTree = ""; }; 9D9AE8682AA76CDC0026E7DC /* LoginItem+NetworkProtection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LoginItem+NetworkProtection.swift"; sourceTree = ""; }; 9D9AE86A2AA76CF90026E7DC /* LoginItemsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginItemsManager.swift; sourceTree = ""; }; 9D9AE8D12AAA39A70026E7DC /* DuckDuckGo Personal Information Removal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DuckDuckGo Personal Information Removal.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -6220,6 +6221,7 @@ 9D9DE5712C63A96400D20B15 /* AppKitExtensions */, 7B9167A82C09E88800322310 /* AppLauncher */, 378E279D2970217400FCADA2 /* BuildToolPlugins */, + 9D9150F32D53F1F1005B5833 /* DataBrokerProtectionShared */, 3192A2702A4C4E330084EA89 /* DataBrokerProtection */, 7B8FDD1E2CDD877000720907 /* FeatureFlags */, 9DF2DB592C73B52F0025F43C /* Freemium */, diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 8083b7c093..a91f76a058 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -30,6 +30,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(path: "../DataBrokerProtectionShared"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), @@ -40,6 +41,7 @@ let package = Package( name: "DataBrokerProtection", dependencies: [ .product(name: "BrowserServicesKit", package: "BrowserServicesKit"), + .product(name: "DataBrokerProtectionShared", package: "DataBrokerProtectionShared"), .product(name: "SwiftUIExtensions", package: "SwiftUIExtensions"), .product(name: "AppKitExtensions", package: "AppKitExtensions"), .byName(name: "XPCHelper"), diff --git a/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/xcshareddata/xcschemes/macOS PIR Tests.xcscheme b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/xcshareddata/xcschemes/macOS PIR Tests.xcscheme new file mode 100644 index 0000000000..5ba440572a --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/.swiftpm/xcode/xcshareddata/xcschemes/macOS PIR Tests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/LocalPackages/DataBrokerProtectionShared/Package.swift b/LocalPackages/DataBrokerProtectionShared/Package.swift new file mode 100644 index 0000000000..f804fc6bf7 --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/Package.swift @@ -0,0 +1,70 @@ +// swift-tools-version: 5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. +// +// Package.swift +// +// Copyright © 2025 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import PackageDescription + +let package = Package( + name: "DataBrokerProtectionShared", + platforms: [ .macOS("11.4") ], + products: [ + .library( + name: "DataBrokerProtectionShared", + targets: ["DataBrokerProtectionShared"]) + ], + dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(path: "../SwiftUIExtensions"), + .package(path: "../AppKitExtensions"), + .package(path: "../XPCHelper"), + .package(path: "../Freemium"), + ], + targets: [ + .target( + name: "DataBrokerProtectionShared", + dependencies: [ + .product(name: "BrowserServicesKit", package: "BrowserServicesKit"), + .product(name: "SwiftUIExtensions", package: "SwiftUIExtensions"), + .product(name: "AppKitExtensions", package: "AppKitExtensions"), + .byName(name: "XPCHelper"), + .product(name: "PixelKit", package: "BrowserServicesKit"), + .product(name: "Configuration", package: "BrowserServicesKit"), + .product(name: "Persistence", package: "BrowserServicesKit"), + .product(name: "Freemium", package: "Freemium"), + ], + resources: [.copy("Resources")], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ] + ), + .testTarget( + name: "DataBrokerProtectionSharedTests", + dependencies: [ + "DataBrokerProtectionShared", + "BrowserServicesKit", + "Freemium", + .product(name: "PersistenceTestingUtils", package: "BrowserServicesKit"), + .product(name: "SubscriptionTestingUtilities", package: "BrowserServicesKit"), + ], + resources: [ + .copy("Resources") + ] + ) + ] +) diff --git a/LocalPackages/DataBrokerProtectionShared/Sources/DataBrokerProtectionShared/DataBrokerProtectionBlank.swift b/LocalPackages/DataBrokerProtectionShared/Sources/DataBrokerProtectionShared/DataBrokerProtectionBlank.swift new file mode 100644 index 0000000000..058d5a708e --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/Sources/DataBrokerProtectionShared/DataBrokerProtectionBlank.swift @@ -0,0 +1,19 @@ +// +// DataBrokerProtectionBlank.swift +// +// Copyright © 2025 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation diff --git a/LocalPackages/DataBrokerProtectionShared/Tests/.swiftlint.yml b/LocalPackages/DataBrokerProtectionShared/Tests/.swiftlint.yml new file mode 100644 index 0000000000..bf8a5655d9 --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/Tests/.swiftlint.yml @@ -0,0 +1,17 @@ +disabled_rules: + - file_length + - unused_closure_parameter + - type_name + - force_cast + - force_try + - function_body_length + - cyclomatic_complexity + - identifier_name + - blanket_disable_command + - type_body_length + - explicit_non_final_class + - enforce_os_log_wrapper + +large_tuple: + warning: 6 + error: 10 diff --git a/LocalPackages/DataBrokerProtectionShared/Tests/DataBrokerProtectionSharedTests/DataBrokerProtectionBlankTests.swift b/LocalPackages/DataBrokerProtectionShared/Tests/DataBrokerProtectionSharedTests/DataBrokerProtectionBlankTests.swift new file mode 100644 index 0000000000..4806322f53 --- /dev/null +++ b/LocalPackages/DataBrokerProtectionShared/Tests/DataBrokerProtectionSharedTests/DataBrokerProtectionBlankTests.swift @@ -0,0 +1,19 @@ +// +// DataBrokerProtectionBlankTests.swift +// +// Copyright © 2025 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation From 347b6828a5d299b3262ec733393d5dde928dac08 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Fri, 7 Feb 2025 10:18:46 +0100 Subject: [PATCH 2/8] Exclude child binaries (#3824) Task/Issue URL: https://app.asana.com/0/1206580121312550/1209309062840626/f ## Description See [Figma](https://www.figma.com/design/y7g8d3Nuefhfedq4638Rhu/VPN%3A-Domain-and-App-exclusions-on-Windows?node-id=134-18153&p=f&m=dev) for reference (keep in mind this is a Windows Figma, and there's no macOS one). Changes: - When a routing-rule is applied to an app through the VPN, its embedded binaries will be subjected to the same rules. --- .../BothAppTargets/VPNURLEventHandler.swift | 10 ++ .../ExcludedApps/ExcludedAppsModel.swift | 2 +- .../AppInfoRetriever/AppInfoRetriever.swift | 112 +++++++++++++++++- .../NetworkProtectionMac/Package.swift | 2 + .../Exclusions/AppRoutingRulesManager.swift | 73 ++++++++++++ .../Provider/TransparentProxyProvider.swift | 6 +- 6 files changed, 199 insertions(+), 6 deletions(-) create mode 100644 LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Exclusions/AppRoutingRulesManager.swift diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNURLEventHandler.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNURLEventHandler.swift index 064b20bd8f..e63932f4f2 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNURLEventHandler.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNURLEventHandler.swift @@ -90,6 +90,16 @@ final class VPNURLEventHandler { PixelKit.fire(PrivacyProPixel.privacyProOfferScreenImpression) } + func showVPNAppExclusions() { + windowControllerManager.showPreferencesTab(withSelectedPane: .vpn) + windowControllerManager.showVPNAppExclusions() + } + + func showVPNDomainExclusions() { + windowControllerManager.showPreferencesTab(withSelectedPane: .vpn) + windowControllerManager.showVPNDomainExclusions() + } + #if !APPSTORE && !DEBUG func moveAppToApplicationsFolder() { // this should be run after NSApplication.shared is set diff --git a/DuckDuckGo/NetworkProtection/ExcludedApps/ExcludedAppsModel.swift b/DuckDuckGo/NetworkProtection/ExcludedApps/ExcludedAppsModel.swift index b487386cde..9f10f89c2c 100644 --- a/DuckDuckGo/NetworkProtection/ExcludedApps/ExcludedAppsModel.swift +++ b/DuckDuckGo/NetworkProtection/ExcludedApps/ExcludedAppsModel.swift @@ -31,7 +31,7 @@ protocol ExcludedAppsModel { } final class DefaultExcludedAppsModel { - private let appInfoRetriever: AppInfoRetrieveing = AppInfoRetriever() + private let appInfoRetriever: AppInfoRetrieving = AppInfoRetriever() let proxySettings = TransparentProxySettings(defaults: .netP) private let pixelKit: PixelFiring? diff --git a/LocalPackages/AppInfoRetriever/Sources/AppInfoRetriever/AppInfoRetriever.swift b/LocalPackages/AppInfoRetriever/Sources/AppInfoRetriever/AppInfoRetriever.swift index 4124a2fe65..c356cc86af 100644 --- a/LocalPackages/AppInfoRetriever/Sources/AppInfoRetriever/AppInfoRetriever.swift +++ b/LocalPackages/AppInfoRetriever/Sources/AppInfoRetriever/AppInfoRetriever.swift @@ -19,24 +19,71 @@ import AppKit import Foundation -public protocol AppInfoRetrieveing { +/// Protocol to provide a mechanism to query information about installed Applications. +/// +public protocol AppInfoRetrieving { - /// Provides a structure featuring commonly-used app info. + /// Provides a structure featuring commonly-used app info given the Application's bundleID. /// - /// It's also possible to retrieve the individual information directly by calling other methods in this class. + /// - Parameters: + /// - bundleID: the bundleID of the target Application. /// func getAppInfo(bundleID: String) -> AppInfo? + + /// Provides a structure featuring commonly-used app info, given the Application's URL. + /// + /// - Parameters: + /// - appURL: the URL where the target Application is installed. + /// func getAppInfo(appURL: URL) -> AppInfo? + + /// Obtains the icon for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// func getAppIcon(bundleID: String) -> NSImage? + + /// Obtains the URL for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// + func getAppURL(bundleID: String) -> URL? + + /// Obtains the visible name for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// func getAppName(bundleID: String) -> String? + + /// Obtains the bundleID for a specified application. + /// + /// - Parameters: + /// - appURL: the URL where the target Application is installed. + /// func getBundleID(appURL: URL) -> String? + /// Obtains the bundleIDs for all Applications embedded within a speciried application. + /// + /// - Parameters: + /// - bundleURL: the URL where the parent Application is installed. + /// + func findEmbeddedBundleIDs(in bundleURL: URL) -> Set } -public class AppInfoRetriever: AppInfoRetrieveing { +/// Provides a mechanism to query information about installed Applications. +/// +public class AppInfoRetriever: AppInfoRetrieving { public init() {} + /// Provides a structure featuring commonly-used app info given the Application's bundleID. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// public func getAppInfo(bundleID: String) -> AppInfo? { guard let appName = getAppName(bundleID: bundleID) else { return nil @@ -46,6 +93,11 @@ public class AppInfoRetriever: AppInfoRetrieveing { return AppInfo(bundleID: bundleID, name: appName, icon: appIcon) } + /// Provides a structure featuring commonly-used app info, given the Application's URL. + /// + /// - Parameters: + /// - appURL: the URL where the target Application is installed. + /// public func getAppInfo(appURL: URL) -> AppInfo? { guard let bundleID = getBundleID(appURL: appURL) else { return nil @@ -54,6 +106,11 @@ public class AppInfoRetriever: AppInfoRetrieveing { return getAppInfo(bundleID: bundleID) } + /// Obtains the icon for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// public func getAppIcon(bundleID: String) -> NSImage? { guard let appURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID) else { return nil @@ -72,6 +129,11 @@ public class AppInfoRetriever: AppInfoRetrieveing { return NSImage(contentsOf: iconURL) } + /// Obtains the visible name for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// public func getAppName(bundleID: String) -> String? { if let appURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID) { // Try reading from Info.plist @@ -86,6 +148,20 @@ public class AppInfoRetriever: AppInfoRetrieveing { return nil } + /// Obtains the URL for a specified application. + /// + /// - Parameters: + /// - bundleID: the bundleID of the target Application. + /// + public func getAppURL(bundleID: String) -> URL? { + NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID) + } + + /// Obtains the bundleID for a specified application. + /// + /// - Parameters: + /// - appURL: the URL where the target Application is installed. + /// public func getBundleID(appURL: URL) -> String? { let infoPlistURL = appURL.appendingPathComponent("Contents/Info.plist") if let plist = NSDictionary(contentsOf: infoPlistURL), @@ -94,4 +170,32 @@ public class AppInfoRetriever: AppInfoRetrieveing { } return nil } + + // MARK: - Embedded Bundle IDs + + /// Obtains the bundleIDs for all Applications embedded within a speciried application. + /// + /// - Parameters: + /// - bundleURL: the URL where the parent Application is installed. + /// + public func findEmbeddedBundleIDs(in bundleURL: URL) -> Set { + var bundleIDs: [String] = [] + let fileManager = FileManager.default + + guard let enumerator = fileManager.enumerator(at: bundleURL, + includingPropertiesForKeys: nil, + options: [.skipsHiddenFiles], + errorHandler: nil) else { + return [] + } + + for case let fileURL as URL in enumerator where fileURL.pathExtension == "app" { + let embeddedBundle = Bundle(url: fileURL) + if let bundleID = embeddedBundle?.bundleIdentifier { + bundleIDs.append(bundleID) + } + } + + return Set(bundleIDs) + } } diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 6a3b56c730..67057ff5ae 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -35,6 +35,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), + .package(path: "../AppInfoRetriever"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), .package(path: "../XPCHelper"), @@ -62,6 +63,7 @@ let package = Package( .target( name: "NetworkProtectionProxy", dependencies: [ + "AppInfoRetriever", .product(name: "NetworkProtection", package: "BrowserServicesKit"), .product(name: "PixelKit", package: "BrowserServicesKit"), ], diff --git a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Exclusions/AppRoutingRulesManager.swift b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Exclusions/AppRoutingRulesManager.swift new file mode 100644 index 0000000000..e850c25da5 --- /dev/null +++ b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Exclusions/AppRoutingRulesManager.swift @@ -0,0 +1,73 @@ +// +// AppRoutingRulesManager.swift +// +// Copyright © 2025 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import AppInfoRetriever +import Foundation +import Combine + +/// Manages App routing rules. +/// +/// This manager expands the routing rules stored in the Proxy settings to include the bundleIDs +/// of all embedded binaries. This is useful because when blocking or excluding an app the user +/// likely expects the rule to extend to all child processes. +/// +final class AppRoutingRulesManager { + + private let appInfoRetriever: AppInfoRetrieving + private(set) var rules: VPNAppRoutingRules + private var cancellables = Set() + + init(settings: TransparentProxySettings, + appInfoRetriever: AppInfoRetrieving = AppInfoRetriever()) { + + self.appInfoRetriever = appInfoRetriever + self.rules = Self.expandAppRoutingRules(settings.appRoutingRules, appInfoRetriever: appInfoRetriever) + + subscribeToAppRoutingRulesChanges(settings) + } + + static func expandAppRoutingRules(_ rules: VPNAppRoutingRules, + appInfoRetriever: AppInfoRetrieving) -> VPNAppRoutingRules { + + var expandedRules = rules + + for (bundleID, rule) in rules { + guard let bundleURL = appInfoRetriever.getAppURL(bundleID: bundleID) else { + continue + } + + let embeddedAppBundleIDs = appInfoRetriever.findEmbeddedBundleIDs(in: bundleURL) + + for childBundleID in embeddedAppBundleIDs { + expandedRules[childBundleID] = rule + } + } + + return expandedRules + } + + private func subscribeToAppRoutingRulesChanges(_ settings: TransparentProxySettings) { + settings.appRoutingRulesPublisher + .receive(on: DispatchQueue.main) + .map { [appInfoRetriever] rules in + return Self.expandAppRoutingRules(rules, appInfoRetriever: appInfoRetriever) + } + .assign(to: \.rules, onWeaklyHeld: self) + .store(in: &cancellables) + } +} diff --git a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Provider/TransparentProxyProvider.swift b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Provider/TransparentProxyProvider.swift index 077c3b2727..92d1ceada2 100644 --- a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Provider/TransparentProxyProvider.swift +++ b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionProxy/Provider/TransparentProxyProvider.swift @@ -16,6 +16,7 @@ // limitations under the License. // +import AppInfoRetriever import Combine import Foundation import NetworkExtension @@ -91,6 +92,7 @@ open class TransparentProxyProvider: NETransparentProxyProvider { @MainActor public var isRunning = false + private let appRoutingRulesManager: AppRoutingRulesManager private let logger: Logger private let appMessageHandler: TransparentProxyAppMessageHandler private let eventHandler: TransparentProxyProviderEventHandler @@ -108,6 +110,8 @@ open class TransparentProxyProvider: NETransparentProxyProvider { self.settings = settings self.eventHandler = eventHandler + appRoutingRulesManager = AppRoutingRulesManager(settings: settings) + super.init() subscribeToSettings() @@ -445,7 +449,7 @@ open class TransparentProxyProvider: NETransparentProxyProvider { private func path(for flow: NEAppProxyFlow) -> FlowPath { let appIdentifier = flow.metaData.sourceAppSigningIdentifier - switch settings.appRoutingRules[appIdentifier] { + switch appRoutingRulesManager.rules[appIdentifier] { case .none: if let hostname = flow.remoteHostname, isExcludedDomain(hostname) { From bb86771e20ef7a4f31ab616ab7f5aecd498f7e7a Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Fri, 7 Feb 2025 11:23:26 +0100 Subject: [PATCH 3/8] VPN is sometimes stopped twice (#3829) Task/Issue URL: https://app.asana.com/0/1207603085593419/1209322889682604/f iOS PR: https://github.com/duckduckgo/iOS/pull/3928 BSK PR: https://github.com/duckduckgo/BrowserServicesKit/pull/1213 **Description**: Fixes an issue where the tunnel is being stopped twice. --- DuckDuckGo-macOS.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- .../Experiment/PixelExperiment.swift | 2 +- .../DataBrokerProtection/Package.swift | 2 +- .../DataBrokerProtectionShared/Package.swift | 2 +- LocalPackages/FeatureFlags/Package.swift | 2 +- LocalPackages/HistoryView/Package.swift | 2 +- .../NetworkProtectionMac/Package.swift | 2 +- LocalPackages/NewTabPage/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- .../UserScriptActionsManager/Package.swift | 2 +- LocalPackages/WebKitExtensions/Package.swift | 2 +- ...ptionPagesUseSubscriptionFeatureTests.swift | 18 +++++++++--------- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/DuckDuckGo-macOS.xcodeproj/project.pbxproj b/DuckDuckGo-macOS.xcodeproj/project.pbxproj index cc020075fb..9399123b5b 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.pbxproj +++ b/DuckDuckGo-macOS.xcodeproj/project.pbxproj @@ -15686,7 +15686,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 236.0.0; + version = 236.0.1; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 17f8aa4566..1f575d93a9 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "1169c5565a1d6e3091e93448a28485a736dfa6d4", - "version" : "236.0.0" + "revision" : "ab64a6616c7b726a55b6c67c0da421c636db1224", + "version" : "236.0.1" } }, { @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "ff0f781cf7c6a22d52957e50b104f5768b50c779", - "version" : "3.10.0" + "revision" : "f2f3774fd116a305136b6866e5e7cb7dff39d8f2", + "version" : "3.10.1" } }, { diff --git a/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift b/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift index 2e92735157..dc1c05b1c3 100644 --- a/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift +++ b/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift @@ -287,7 +287,7 @@ final internal class PixelExperimentLogic { DispatchQueue.main.async { let now = self.now() - if now >= AppDelegate.firstLaunchDate.adding(.days(21)) && now <= AppDelegate.firstLaunchDate.adding(.days(27)) { + if now >= AppDelegate.firstLaunchDate.addingTimeInterval(.days(21)) && now <= AppDelegate.firstLaunchDate.addingTimeInterval(.days(27)) { PixelKit.fire(GeneralPixel.serpDay21to27(cohort: cohort.rawValue), frequency: .legacyInitial, includeAppVersionParameter: false) } } diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index a91f76a058..a81b00cea4 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../DataBrokerProtectionShared"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), diff --git a/LocalPackages/DataBrokerProtectionShared/Package.swift b/LocalPackages/DataBrokerProtectionShared/Package.swift index f804fc6bf7..727eca6597 100644 --- a/LocalPackages/DataBrokerProtectionShared/Package.swift +++ b/LocalPackages/DataBrokerProtectionShared/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtectionShared"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), diff --git a/LocalPackages/FeatureFlags/Package.swift b/LocalPackages/FeatureFlags/Package.swift index 95ecd9f224..2a7642fe18 100644 --- a/LocalPackages/FeatureFlags/Package.swift +++ b/LocalPackages/FeatureFlags/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["FeatureFlags"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/HistoryView/Package.swift b/LocalPackages/HistoryView/Package.swift index 2a3a54cdea..69037aa789 100644 --- a/LocalPackages/HistoryView/Package.swift +++ b/LocalPackages/HistoryView/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["HistoryView"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 67057ff5ae..7c0f269380 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -33,7 +33,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppInfoRetriever"), .package(path: "../AppLauncher"), diff --git a/LocalPackages/NewTabPage/Package.swift b/LocalPackages/NewTabPage/Package.swift index 3e5b9d5929..e38eb09218 100644 --- a/LocalPackages/NewTabPage/Package.swift +++ b/LocalPackages/NewTabPage/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["NewTabPage"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index ab3ac1438f..2097829049 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../PreferencesUI-macOS"), .package(path: "../SwiftUIExtensions"), .package(path: "../FeatureFlags") diff --git a/LocalPackages/UserScriptActionsManager/Package.swift b/LocalPackages/UserScriptActionsManager/Package.swift index a20fdedb24..6af1e94405 100644 --- a/LocalPackages/UserScriptActionsManager/Package.swift +++ b/LocalPackages/UserScriptActionsManager/Package.swift @@ -31,7 +31,7 @@ let package = Package( targets: ["UserScriptActionsManager"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), ], targets: [ .target( diff --git a/LocalPackages/WebKitExtensions/Package.swift b/LocalPackages/WebKitExtensions/Package.swift index 34e25d329d..de580b0dba 100644 --- a/LocalPackages/WebKitExtensions/Package.swift +++ b/LocalPackages/WebKitExtensions/Package.swift @@ -32,7 +32,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), .package(path: "../AppKitExtensions") ], targets: [ diff --git a/UnitTests/Subscription/SubscriptionPagesUseSubscriptionFeatureTests.swift b/UnitTests/Subscription/SubscriptionPagesUseSubscriptionFeatureTests.swift index f72b2cd866..375c9b8737 100644 --- a/UnitTests/Subscription/SubscriptionPagesUseSubscriptionFeatureTests.swift +++ b/UnitTests/Subscription/SubscriptionPagesUseSubscriptionFeatureTests.swift @@ -426,7 +426,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) authService.storeLoginResult = .success(StoreLoginResponse(authToken: Constants.authToken, email: Constants.email, externalID: Constants.externalID, @@ -470,7 +470,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) authService.storeLoginResult = .success(StoreLoginResponse(authToken: Constants.authToken, email: Constants.email, externalID: Constants.externalID, @@ -516,7 +516,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) // When let subscriptionSelectedParams = ["id": "some-subscription-id"] @@ -547,7 +547,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) // When let subscriptionSelectedParams = ["id": "some-subscription-id"] @@ -609,7 +609,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { status: "authenticated")) authService.getAccessTokenResult = .success(AccessTokenResponse(accessToken: Constants.accessToken)) authService.validateTokenResult = .success(Constants.validateTokenResponse) - subscriptionService.getSubscriptionResult = .success(SubscriptionMockFactory.subscription) + subscriptionService.getSubscriptionResult = .success(SubscriptionMockFactory.appleSubscription) // When let subscriptionSelectedParams = ["id": "some-subscription-id"] @@ -1009,7 +1009,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) authService.storeLoginResult = .success(StoreLoginResponse(authToken: Constants.authToken, email: Constants.email, externalID: Constants.externalID, @@ -1048,7 +1048,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) authService.storeLoginResult = .success(StoreLoginResponse(authToken: Constants.authToken, email: Constants.email, externalID: Constants.externalID, @@ -1088,7 +1088,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) authService.storeLoginResult = .success(StoreLoginResponse(authToken: Constants.authToken, email: Constants.email, externalID: Constants.externalID, @@ -1131,7 +1131,7 @@ final class SubscriptionPagesUseSubscriptionFeatureTests: XCTestCase { storePurchaseManager.purchaseSubscriptionResult = .success(Constants.mostRecentTransactionJWS) subscriptionService.confirmPurchaseResult = .success(ConfirmPurchaseResponse(email: Constants.email, entitlements: Constants.entitlements, - subscription: SubscriptionMockFactory.subscription)) + subscription: SubscriptionMockFactory.appleSubscription)) mockFreemiumDBPUserStateManager.didPostFirstProfileSavedNotification = false feature.with(broker: broker) From 600bec736e8b3ed6f2cb6c40744f38bbc68d6b83 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio Date: Fri, 7 Feb 2025 15:21:00 +0100 Subject: [PATCH 4/8] quick fix for allowlist crash --- DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift index 144d5eb300..1855fdc155 100644 --- a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift +++ b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift @@ -36,7 +36,8 @@ final class ContentBlockerRulesLists: DefaultContentBlockerRulesListsSource { if adClickAttribution.isEnabled, let tdsRulesIndex = result.firstIndex(where: { $0.name == DefaultContentBlockerRulesListsSource.Constants.trackerDataSetRulesListName }) { let tdsRules = result[tdsRulesIndex] - let allowlistedTrackerNames = adClickAttribution.allowlist.map { $0.entity } + let allowlist = adClickAttribution.allowlist + let allowlistedTrackerNames = allowlist.map { $0.entity } let adSplitter = AdClickAttributionRulesSplitter(rulesList: tdsRules, allowlistedTrackerNames: allowlistedTrackerNames) if let splitRules = adSplitter.split() { result.remove(at: tdsRulesIndex) From 079ce64ec8c60792f61387ff5a44e73b23b46574 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio Date: Fri, 7 Feb 2025 15:22:32 +0100 Subject: [PATCH 5/8] Revert "quick fix for allowlist crash" This reverts commit 600bec736e8b3ed6f2cb6c40744f38bbc68d6b83. --- DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift index 1855fdc155..144d5eb300 100644 --- a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift +++ b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift @@ -36,8 +36,7 @@ final class ContentBlockerRulesLists: DefaultContentBlockerRulesListsSource { if adClickAttribution.isEnabled, let tdsRulesIndex = result.firstIndex(where: { $0.name == DefaultContentBlockerRulesListsSource.Constants.trackerDataSetRulesListName }) { let tdsRules = result[tdsRulesIndex] - let allowlist = adClickAttribution.allowlist - let allowlistedTrackerNames = allowlist.map { $0.entity } + let allowlistedTrackerNames = adClickAttribution.allowlist.map { $0.entity } let adSplitter = AdClickAttributionRulesSplitter(rulesList: tdsRules, allowlistedTrackerNames: allowlistedTrackerNames) if let splitRules = adSplitter.split() { result.remove(at: tdsRulesIndex) From fc35cc77c489bd54989955b6460feb92a16b61d0 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Fri, 7 Feb 2025 17:05:05 +0100 Subject: [PATCH 6/8] Fix displaying long URLs on HTML NTP Recent Activity feed (#3848) Task/Issue URL: https://app.asana.com/0/0/1209351911435697/f Description: Update BSK to a version containing C-S-S fix for HTML New Tab Page. --- DuckDuckGo-macOS.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/FeatureFlags/Package.swift | 2 +- LocalPackages/HistoryView/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- LocalPackages/NewTabPage/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- LocalPackages/UserScriptActionsManager/Package.swift | 2 +- LocalPackages/WebKitExtensions/Package.swift | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DuckDuckGo-macOS.xcodeproj/project.pbxproj b/DuckDuckGo-macOS.xcodeproj/project.pbxproj index a6caa97379..ba598dd102 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.pbxproj +++ b/DuckDuckGo-macOS.xcodeproj/project.pbxproj @@ -15660,7 +15660,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 235.2.0; + version = "235.2.0-1"; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8541ac95eb..bb0de61b13 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "744895ff98a5f2213333be0170e495b1e85034d0", - "version" : "235.2.0" + "revision" : "b5fe560f24fa3a02270d798f8b01607934cf2304", + "version" : "235.2.0-1" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/content-scope-scripts", "state" : { - "revision" : "4a6bca2433aec573369546291bb6c53addef0a5f", - "version" : "7.15.0" + "revision" : "1876d68142cf4f9abfaaee235a015d287eb71226", + "version" : "7.17.0" } }, { diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 830e92113e..8db9bda224 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), diff --git a/LocalPackages/FeatureFlags/Package.swift b/LocalPackages/FeatureFlags/Package.swift index 4e4c268a74..b4fe63d1bc 100644 --- a/LocalPackages/FeatureFlags/Package.swift +++ b/LocalPackages/FeatureFlags/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["FeatureFlags"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/HistoryView/Package.swift b/LocalPackages/HistoryView/Package.swift index f74adf87a4..c4ef2d5f9d 100644 --- a/LocalPackages/HistoryView/Package.swift +++ b/LocalPackages/HistoryView/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["HistoryView"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 5e798f9193..713b44b7ac 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -33,7 +33,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), diff --git a/LocalPackages/NewTabPage/Package.swift b/LocalPackages/NewTabPage/Package.swift index 2d47eae307..c0e57f76a4 100644 --- a/LocalPackages/NewTabPage/Package.swift +++ b/LocalPackages/NewTabPage/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["NewTabPage"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 7b3ea07626..a6703e62ff 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(path: "../PreferencesUI-macOS"), .package(path: "../SwiftUIExtensions"), .package(path: "../FeatureFlags") diff --git a/LocalPackages/UserScriptActionsManager/Package.swift b/LocalPackages/UserScriptActionsManager/Package.swift index 1c0d399af1..89c94cbf52 100644 --- a/LocalPackages/UserScriptActionsManager/Package.swift +++ b/LocalPackages/UserScriptActionsManager/Package.swift @@ -31,7 +31,7 @@ let package = Package( targets: ["UserScriptActionsManager"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), ], targets: [ .target( diff --git a/LocalPackages/WebKitExtensions/Package.swift b/LocalPackages/WebKitExtensions/Package.swift index 28a344be14..92c5f9e683 100644 --- a/LocalPackages/WebKitExtensions/Package.swift +++ b/LocalPackages/WebKitExtensions/Package.swift @@ -32,7 +32,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "235.2.0-1"), .package(path: "../AppKitExtensions") ], targets: [ From 24f48e49a675ce90552cb1475a319cf68f38bf53 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Fri, 7 Feb 2025 17:09:36 +0100 Subject: [PATCH 7/8] Bump BSK to the newest version (#3849) Task/Issue URL: https://app.asana.com/0/414235014887631/1209351911435697 Description: Update BSK to a version containing C-S-S fix for HTML New Tab Page. --- DuckDuckGo-macOS.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/DataBrokerProtectionShared/Package.swift | 2 +- LocalPackages/FeatureFlags/Package.swift | 2 +- LocalPackages/HistoryView/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- LocalPackages/NewTabPage/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- LocalPackages/UserScriptActionsManager/Package.swift | 2 +- LocalPackages/WebKitExtensions/Package.swift | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DuckDuckGo-macOS.xcodeproj/project.pbxproj b/DuckDuckGo-macOS.xcodeproj/project.pbxproj index 9399123b5b..da56a345b2 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.pbxproj +++ b/DuckDuckGo-macOS.xcodeproj/project.pbxproj @@ -15686,7 +15686,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 236.0.1; + version = 236.0.2; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1f575d93a9..cee8ff1865 100644 --- a/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo-macOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "ab64a6616c7b726a55b6c67c0da421c636db1224", - "version" : "236.0.1" + "revision" : "8b7cb167b94dea66313175c88234fdc3cd2db306", + "version" : "236.0.2" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/content-scope-scripts", "state" : { - "revision" : "7a37fdc86198b0447e9ff17dbf494171bfaddc33", - "version" : "7.16.0" + "revision" : "1876d68142cf4f9abfaaee235a015d287eb71226", + "version" : "7.17.0" } }, { diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index a81b00cea4..d37ef8f267 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../DataBrokerProtectionShared"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), diff --git a/LocalPackages/DataBrokerProtectionShared/Package.swift b/LocalPackages/DataBrokerProtectionShared/Package.swift index 727eca6597..311d18fca0 100644 --- a/LocalPackages/DataBrokerProtectionShared/Package.swift +++ b/LocalPackages/DataBrokerProtectionShared/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtectionShared"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), diff --git a/LocalPackages/FeatureFlags/Package.swift b/LocalPackages/FeatureFlags/Package.swift index 2a7642fe18..959c601d34 100644 --- a/LocalPackages/FeatureFlags/Package.swift +++ b/LocalPackages/FeatureFlags/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["FeatureFlags"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/HistoryView/Package.swift b/LocalPackages/HistoryView/Package.swift index 69037aa789..f1d016b08e 100644 --- a/LocalPackages/HistoryView/Package.swift +++ b/LocalPackages/HistoryView/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["HistoryView"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 7c0f269380..36f3da0929 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -33,7 +33,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppInfoRetriever"), .package(path: "../AppLauncher"), diff --git a/LocalPackages/NewTabPage/Package.swift b/LocalPackages/NewTabPage/Package.swift index e38eb09218..0dcf7c303f 100644 --- a/LocalPackages/NewTabPage/Package.swift +++ b/LocalPackages/NewTabPage/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["NewTabPage"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../WebKitExtensions"), .package(path: "../UserScriptActionsManager"), .package(path: "../Utilities"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 2097829049..203804f421 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../PreferencesUI-macOS"), .package(path: "../SwiftUIExtensions"), .package(path: "../FeatureFlags") diff --git a/LocalPackages/UserScriptActionsManager/Package.swift b/LocalPackages/UserScriptActionsManager/Package.swift index 6af1e94405..ec9560c363 100644 --- a/LocalPackages/UserScriptActionsManager/Package.swift +++ b/LocalPackages/UserScriptActionsManager/Package.swift @@ -31,7 +31,7 @@ let package = Package( targets: ["UserScriptActionsManager"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), ], targets: [ .target( diff --git a/LocalPackages/WebKitExtensions/Package.swift b/LocalPackages/WebKitExtensions/Package.swift index de580b0dba..a0dde0d469 100644 --- a/LocalPackages/WebKitExtensions/Package.swift +++ b/LocalPackages/WebKitExtensions/Package.swift @@ -32,7 +32,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.1"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"), .package(path: "../AppKitExtensions") ], targets: [ From a60dcd8e314546c7f55e9bdce8f64fc0ad2fd824 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:09:40 +0100 Subject: [PATCH 8/8] quick fix for allowlist crash (#3847) Task/Issue URL: https://app.asana.com/0/1204186595873227/1209345938720177 **Description**: Improves concurrency problems where allowlist is modified or deallocated while in use in the contentBlockerRulesLists getter. This is a quick fix for the release branch, but we should follow up with making allowlist thread safe in BSK --- DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift index 144d5eb300..1855fdc155 100644 --- a/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift +++ b/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift @@ -36,7 +36,8 @@ final class ContentBlockerRulesLists: DefaultContentBlockerRulesListsSource { if adClickAttribution.isEnabled, let tdsRulesIndex = result.firstIndex(where: { $0.name == DefaultContentBlockerRulesListsSource.Constants.trackerDataSetRulesListName }) { let tdsRules = result[tdsRulesIndex] - let allowlistedTrackerNames = adClickAttribution.allowlist.map { $0.entity } + let allowlist = adClickAttribution.allowlist + let allowlistedTrackerNames = allowlist.map { $0.entity } let adSplitter = AdClickAttributionRulesSplitter(rulesList: tdsRules, allowlistedTrackerNames: allowlistedTrackerNames) if let splitRules = adSplitter.split() { result.remove(at: tdsRulesIndex)