Skip to content

Commit

Permalink
Remediate TunnelVision, TunnelCrack and fix "Exclude Local Networks" (#…
Browse files Browse the repository at this point in the history
…3422)

Task/Issue URL:
https://app.asana.com/0/1206580121312550/1208686409805161/f
Tech Design URL:
https://app.asana.com/0/481882893211075/1208643192597095/f

iOS PR: iOS PR: duckduckgo/iOS#3460
BSK PR: duckduckgo/BrowserServicesKit#1039

## Description

Remediate TunnelVision, TunnelCrack and fix "Exclude Local Networks".
  • Loading branch information
diegoreymendez authored Nov 11, 2024
1 parent 711c1a1 commit 20c9f0a
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 99 deletions.
60 changes: 34 additions & 26 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,10 @@
7B8594192B5B26230007EB3E /* UDSHelper in Frameworks */ = {isa = PBXBuildFile; productRef = 7B8594182B5B26230007EB3E /* UDSHelper */; };
7B874BD62CBD7E8D009C6C63 /* VPNProxyExtension.appex in Embed Network Extensions */ = {isa = PBXBuildFile; fileRef = 7BDA36E52B7E037100AD5388 /* VPNProxyExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
7B8DB31A2B504D7500EC16DA /* VPNAppEventsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B8DB3192B504D7500EC16DA /* VPNAppEventsHandler.swift */; };
7B8FDD202CDD88C500720907 /* FeatureFlags in Frameworks */ = {isa = PBXBuildFile; productRef = 7B8FDD1F2CDD88C500720907 /* FeatureFlags */; };
7B8FDD222CDD88CB00720907 /* FeatureFlags in Frameworks */ = {isa = PBXBuildFile; productRef = 7B8FDD212CDD88CB00720907 /* FeatureFlags */; };
7B8FDD242CDD88D300720907 /* FeatureFlags in Frameworks */ = {isa = PBXBuildFile; productRef = 7B8FDD232CDD88D300720907 /* FeatureFlags */; };
7B8FDD262CDD88D900720907 /* FeatureFlags in Frameworks */ = {isa = PBXBuildFile; productRef = 7B8FDD252CDD88D900720907 /* FeatureFlags */; };
7B934C412A866DD400FC8F9C /* UserDefaults+NetworkProtectionShared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B934C402A866DD400FC8F9C /* UserDefaults+NetworkProtectionShared.swift */; };
7B97CD592B7E0B57004FEF43 /* NetworkProtectionProxy in Frameworks */ = {isa = PBXBuildFile; productRef = 7B97CD582B7E0B57004FEF43 /* NetworkProtectionProxy */; };
7B97CD5B2B7E0B85004FEF43 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 7B97CD5A2B7E0B85004FEF43 /* Common */; };
Expand Down Expand Up @@ -3041,8 +3045,6 @@
EEC8EB3E2982CA3B0065AA39 /* JSAlertViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEC111E5294D06290086524F /* JSAlertViewModel.swift */; };
EEC8EB3F2982CA440065AA39 /* JSAlert.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EEC111E3294D06020086524F /* JSAlert.storyboard */; };
EEC8EB402982CD550065AA39 /* JSAlertViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF53E172950CED5002D78F4 /* JSAlertViewModelTests.swift */; };
EECE10E529DD77E60044D027 /* FeatureFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECE10E429DD77E60044D027 /* FeatureFlag.swift */; };
EECE10E629DD77E60044D027 /* FeatureFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECE10E429DD77E60044D027 /* FeatureFlag.swift */; };
EED4D3D82C874AE200C79EEA /* PopoverInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED4D3D72C874AE200C79EEA /* PopoverInfoViewController.swift */; };
EED4D3D92C874AE200C79EEA /* PopoverInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED4D3D72C874AE200C79EEA /* PopoverInfoViewController.swift */; };
EED4D3DF2C8A298D00C79EEA /* AutofillPixelEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */; };
Expand Down Expand Up @@ -4046,6 +4048,7 @@
7B7F5D232C52725A00826256 /* AddExcludedDomainButtonsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddExcludedDomainButtonsView.swift; sourceTree = "<group>"; };
7B8594172B5B25FB0007EB3E /* UDSHelper */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = UDSHelper; sourceTree = "<group>"; };
7B8DB3192B504D7500EC16DA /* VPNAppEventsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNAppEventsHandler.swift; sourceTree = "<group>"; };
7B8FDD1E2CDD877000720907 /* FeatureFlags */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = FeatureFlags; sourceTree = "<group>"; };
7B9167A82C09E88800322310 /* AppLauncher */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = AppLauncher; sourceTree = "<group>"; };
7B934C3D2A866CFF00FC8F9C /* NetworkProtectionOnboardingMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkProtectionOnboardingMenu.swift; sourceTree = "<group>"; };
7B934C402A866DD400FC8F9C /* UserDefaults+NetworkProtectionShared.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserDefaults+NetworkProtectionShared.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4860,7 +4863,6 @@
EEC4A66C2B2C894F00F7C0AA /* VPNLocationPreferenceItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNLocationPreferenceItemModel.swift; sourceTree = "<group>"; };
EEC4A6702B2C90AB00F7C0AA /* VPNLocationPreferenceItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNLocationPreferenceItem.swift; sourceTree = "<group>"; };
EEC7BE2D2BC6C09400F86835 /* AddressBarKeyboardShortcutsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddressBarKeyboardShortcutsTests.swift; sourceTree = "<group>"; };
EECE10E429DD77E60044D027 /* FeatureFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlag.swift; sourceTree = "<group>"; };
EED4D3D72C874AE200C79EEA /* PopoverInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopoverInfoViewController.swift; sourceTree = "<group>"; };
EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillPixelEvent.swift; sourceTree = "<group>"; };
EED735352BB46B6000F173D6 /* AutocompleteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutocompleteTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4918,6 +4920,7 @@
4BF97AD32B43C43F00EB4240 /* NetworkProtectionUI in Frameworks */,
7B1459572B7D43E500047F2C /* NetworkProtectionProxy in Frameworks */,
B6F7128229F6820A00594A45 /* QuickLookUI.framework in Frameworks */,
7B8FDD262CDD88D900720907 /* FeatureFlags in Frameworks */,
CBECDB902CDBD631005B8B87 /* BrokenSitePrompt in Frameworks */,
9FF521482BAA909C00B9819B /* Lottie in Frameworks */,
CBECDB8E2CDBD62C005B8B87 /* PageRefreshMonitor in Frameworks */,
Expand Down Expand Up @@ -5029,6 +5032,7 @@
4B41EDAB2B1544B2001EEDF4 /* LoginItems in Frameworks */,
7B00997D2B6508B700FE7C31 /* NetworkProtectionProxy in Frameworks */,
7BEEA5122AD1235B00A9E72B /* NetworkProtectionIPC in Frameworks */,
7B8FDD202CDD88C500720907 /* FeatureFlags in Frameworks */,
7BA7CC5F2AD1210C0042E5CE /* Networking in Frameworks */,
02A15D942C88D78F001A4237 /* Persistence in Frameworks */,
7BEEA5162AD1236E00A9E72B /* NetworkProtectionUI in Frameworks */,
Expand Down Expand Up @@ -5059,6 +5063,7 @@
EE7295EF2A545C12008C0991 /* NetworkProtection in Frameworks */,
4B2D067F2A1334D700DE1F49 /* NetworkProtectionUI in Frameworks */,
4BA7C4DD2B3F64E500AFE511 /* LoginItems in Frameworks */,
7B8FDD222CDD88CB00720907 /* FeatureFlags in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -5182,6 +5187,7 @@
D6BC8AC62C5A95AA0025375B /* DuckPlayer in Frameworks */,
987799ED299998B1005D8EB6 /* Bookmarks in Frameworks */,
1E950E3F2912A10D0051A99B /* ContentBlocking in Frameworks */,
7B8FDD242CDD88D300720907 /* FeatureFlags in Frameworks */,
31A3A4E32B0C115F0021063C /* DataBrokerProtection in Frameworks */,
378F44E429B4BDE900899924 /* SwiftUIExtensions in Frameworks */,
F1D43AF32B98E47800BAB743 /* BareBonesBrowserKit in Frameworks */,
Expand Down Expand Up @@ -5276,29 +5282,12 @@
path = FeatureFlagging;
sourceTree = "<group>";
};
1D36E651298A84F600AA485D /* FeatureFlagging */ = {
isa = PBXGroup;
children = (
1D36E655298AA33400AA485D /* Model */,
1D36E656298AA33C00AA485D /* Services */,
);
path = FeatureFlagging;
sourceTree = "<group>";
};
1D36E655298AA33400AA485D /* Model */ = {
isa = PBXGroup;
children = (
EECE10E429DD77E60044D027 /* FeatureFlag.swift */,
);
path = Model;
sourceTree = "<group>";
};
1D36E656298AA33C00AA485D /* Services */ = {
1D36E651298A84F600AA485D /* InternalUserDecider */ = {
isa = PBXGroup;
children = (
1D36E657298AA3BA00AA485D /* InternalUserDeciderStore.swift */,
);
path = Services;
path = InternalUserDecider;
sourceTree = "<group>";
};
1D3B1AB7293405F5006F4388 /* PasswordManagers */ = {
Expand Down Expand Up @@ -5820,6 +5809,7 @@
7B9167A82C09E88800322310 /* AppLauncher */,
378E279D2970217400FCADA2 /* BuildToolPlugins */,
3192A2702A4C4E330084EA89 /* DataBrokerProtection */,
7B8FDD1E2CDD877000720907 /* FeatureFlags */,
9DF2DB592C73B52F0025F43C /* Freemium */,
9DB6E7222AA0DA7A00A17F3C /* LoginItems */,
7B25FE322AD12C990012AFAB /* NetworkProtectionMac */,
Expand Down Expand Up @@ -7768,7 +7758,6 @@
4B65143C26392483005B46EB /* Email */,
B68412192B6A16030092F66A /* ErrorPage */,
AA5FA695275F823900DCE9C9 /* Favicons */,
1D36E651298A84F600AA485D /* FeatureFlagging */,
AA3863C227A1E1C000749AB5 /* Feedback */,
8556A60C256C15C60092FA9D /* FileDownload */,
85A0115D25AF1C4700FA6A0C /* FindInPage */,
Expand All @@ -7781,6 +7770,7 @@
EED4D3D62C87480B00C79EEA /* InfoViews */,
56CEE9092B7A66C500CF10AA /* Info.plist */,
56CEE90D2B7A6DE100CF10AA /* InfoPlist.xcstrings */,
1D36E651298A84F600AA485D /* InternalUserDecider */,
EEAEA3F4294D05CF00D04DF3 /* JSAlert */,
B658BAB52B0F845D00D1F2C7 /* Localizable.xcstrings */,
9D03F5A22AA74829001A50E8 /* LoginItems */,
Expand Down Expand Up @@ -9777,6 +9767,7 @@
C18BF9CD2C73678C00ED6B8A /* Freemium */,
567A23C42C7F75BB0010F66C /* SpecialErrorPages */,
CD34F0C32C8869FF006826BE /* PhishingDetection */,
7B8FDD252CDD88D900720907 /* FeatureFlags */,
CBECDB8D2CDBD62C005B8B87 /* PageRefreshMonitor */,
CBECDB8F2CDBD631005B8B87 /* BrokenSitePrompt */,
);
Expand Down Expand Up @@ -9944,6 +9935,7 @@
9D9DE5802C63BA0B00D20B15 /* AppKitExtensions */,
02A15D912C88D789001A4237 /* Configuration */,
02A15D932C88D78F001A4237 /* Persistence */,
7B8FDD1F2CDD88C500720907 /* FeatureFlags */,
);
productName = DuckDuckGoAgent;
productReference = 4B2D06392A11CFBB00DE1F49 /* DuckDuckGo VPN.app */;
Expand Down Expand Up @@ -9980,6 +9972,7 @@
9D9DE5822C63BE9600D20B15 /* AppKitExtensions */,
02A15D952C88D797001A4237 /* Configuration */,
02A15D972C88D79D001A4237 /* Persistence */,
7B8FDD212CDD88CB00720907 /* FeatureFlags */,
);
productName = DuckDuckGoAgentAppStore;
productReference = 4B2D06692A13318400DE1F49 /* DuckDuckGo VPN App Store.app */;
Expand Down Expand Up @@ -10249,6 +10242,7 @@
C18BF9CB2C73678500ED6B8A /* Freemium */,
567A23C02C7F71570010F66C /* SpecialErrorPages */,
CD34F0BB2C885D65006826BE /* PhishingDetection */,
7B8FDD232CDD88D300720907 /* FeatureFlags */,
CBECDB892CDBD616005B8B87 /* PageRefreshMonitor */,
CBECDB8B2CDBD61C005B8B87 /* BrokenSitePrompt */,
);
Expand Down Expand Up @@ -11973,7 +11967,6 @@
3706FCA4293F65D500E42796 /* RecentlyClosedMenu.swift in Sources */,
8400DC4C2C6E26AE006509D2 /* ItemCachingCollectionView.swift in Sources */,
4B9DB02D2A983B24000927DB /* WaitlistKeychainStorage.swift in Sources */,
EECE10E629DD77E60044D027 /* FeatureFlag.swift in Sources */,
C181945D2C7CDCC700381092 /* PromotionView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -12802,7 +12795,6 @@
B6D574B429472253008ED1B6 /* FBProtectionTabExtension.swift in Sources */,
AAC30A28268E045400D2D9CD /* CrashReportReader.swift in Sources */,
85AC3B3525DA82A600C7D2AA /* DataTaskProviding.swift in Sources */,
EECE10E529DD77E60044D027 /* FeatureFlag.swift in Sources */,
56406D4B2C636A8900BF8FA2 /* SpecialPagesUserScriptExtension.swift in Sources */,
31521AC02CC013AD00248E6F /* AIChatMenuVisibilityConfigurable.swift in Sources */,
AA3D531727A1EEED00074EC1 /* FeedbackViewController.swift in Sources */,
Expand Down Expand Up @@ -15024,7 +15016,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 208.1.0;
version = 209.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down Expand Up @@ -15527,6 +15519,22 @@
isa = XCSwiftPackageProductDependency;
productName = UDSHelper;
};
7B8FDD1F2CDD88C500720907 /* FeatureFlags */ = {
isa = XCSwiftPackageProductDependency;
productName = FeatureFlags;
};
7B8FDD212CDD88CB00720907 /* FeatureFlags */ = {
isa = XCSwiftPackageProductDependency;
productName = FeatureFlags;
};
7B8FDD232CDD88D300720907 /* FeatureFlags */ = {
isa = XCSwiftPackageProductDependency;
productName = FeatureFlags;
};
7B8FDD252CDD88D900720907 /* FeatureFlags */ = {
isa = XCSwiftPackageProductDependency;
productName = FeatureFlags;
};
7B97CD582B7E0B57004FEF43 /* NetworkProtectionProxy */ = {
isa = XCSwiftPackageProductDependency;
productName = NetworkProtectionProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "6be781530a2516c703b8e1bcf0c90e6e763d3300",
"version" : "208.1.0"
"revision" : "614ea57db48db644ce7f3a3de9c20c9a7fbb08ff",
"version" : "209.0.0"
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
private(set) var stateRestorationManager: AppStateRestorationManager!
private var grammarFeaturesManager = GrammarFeaturesManager()
let internalUserDecider: InternalUserDecider
private var isInternalUserSharingCancellable: AnyCancellable?
let featureFlagger: FeatureFlagger
private var appIconChanger: AppIconChanger!
private var autoClearHandler: AutoClearHandler!
Expand Down Expand Up @@ -433,6 +434,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

subscribeToEmailProtectionStatusNotifications()
subscribeToDataImportCompleteNotification()
subscribeToInternalUserChanges()

fireFailedCompilationsPixelIfNeeded()

Expand Down Expand Up @@ -748,6 +750,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(dataImportCompleteNotification(_:)), name: .dataImportComplete, object: nil)
}

private func subscribeToInternalUserChanges() {
UserDefaults.appConfiguration.isInternalUser = internalUserDecider.isInternalUser

isInternalUserSharingCancellable = internalUserDecider.isInternalUserPublisher
.assign(to: \.isInternalUser, onWeaklyHeld: UserDefaults.appConfiguration)
}

private func emailDidSignInNotification(_ notification: Notification) {
PixelKit.fire(NonStandardEvent(NonStandardPixel.emailEnabled))
if AppDelegate.isNewUser {
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/NavigationBar/View/NetPPopoverManagerMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ final class IPCClientMock: NetworkProtectionIPCClient {
completion(nil)
}

func command(_ command: VPNCommand) async throws {
return
}

}

final class ConnectivityIssueObserverMock: ConnectivityIssueObserver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@ final class NetworkProtectionDebugMenu: NSMenu {
NSMenuItem(title: "Reset All State", action: #selector(NetworkProtectionDebugMenu.resetAllState))
.targetting(self)

NSMenuItem(title: "Reset Site Issue Alert", action: #selector(NetworkProtectionDebugMenu.resetSiteIssuesAlert(_:)))
.targetting(self)
NSMenuItem.separator() // Resetting single components should go below this point

resetToDefaults
NSMenuItem(title: "Remove Network Extension and Login Items", action: #selector(NetworkProtectionDebugMenu.removeSystemExtensionAndAgents))
.targetting(self)

NSMenuItem.separator()
NSMenuItem(title: "Remove VPN configuration", action: #selector(NetworkProtectionDebugMenu.removeVPNConfiguration(_:)))
.targetting(self)

NSMenuItem(title: "Remove Network Extension and Login Items", action: #selector(NetworkProtectionDebugMenu.removeSystemExtensionAndAgents))
resetToDefaults
.targetting(self)

NSMenuItem(title: "Remove VPN configuration", action: #selector(NetworkProtectionDebugMenu.removeVPNConfiguration(_:)))
NSMenuItem.separator() // Resetting VPN subfeatures should go below this point

NSMenuItem(title: "Reset Site Issue Alert", action: #selector(NetworkProtectionDebugMenu.resetSiteIssuesAlert(_:)))
.targetting(self)
}

Expand Down Expand Up @@ -310,14 +312,29 @@ final class NetworkProtectionDebugMenu: NSMenu {

@objc func toggleEnforceRoutesAction(_ sender: Any?) {
settings.enforceRoutes.toggle()

Task {
try await Task.sleep(interval: 0.1)
try await debugUtilities.restartAdapter()
}
}

@objc func toggleIncludeAllNetworks(_ sender: Any?) {
settings.includeAllNetworks.toggle()

Task {
try await Task.sleep(interval: 0.1)
try await debugUtilities.restartAdapter()
}
}

@objc func toggleShouldExcludeLocalRoutes(_ sender: Any?) {
settings.excludeLocalNetworks.toggle()

Task {
try await Task.sleep(interval: 0.1)
try await debugUtilities.restartAdapter()
}
}

@objc func openAppContainerInFinder(_ sender: Any?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protocol NetworkProtectionIPCClient {

func start(completion: @escaping (Error?) -> Void)
func stop(completion: @escaping (Error?) -> Void)
func command(_ command: VPNCommand) async throws
}

extension VPNControllerXPCClient: NetworkProtectionIPCClient {
Expand Down
Loading

0 comments on commit 20c9f0a

Please sign in to comment.