Skip to content

Commit

Permalink
Validate VPN errors before re-throwing them (#3490)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414709148257752/1208225499545869/f
Tech Design URL:
CC:

Description:

This PR updates the VPN to validate errors before throwing them to the OS.
  • Loading branch information
samsymons authored Nov 3, 2024
1 parent f131518 commit 9184e92
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14684,7 +14684,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 202.4.0;
version = 203.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
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" : "80894bf69fe789e41b13f3de6be97f1300ca56e5",
"version" : "202.4.0"
"revision" : "45261df2963fc89094e169f9f2d0d9aa098093f3",
"version" : "203.0.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case networkProtectionConfigurationPixelTest
case networkProtectionConfigurationFailedToParse(_ error: Error)

case networkProtectionMalformedErrorDetected(_ error: Error)

case networkProtectionUnhandledError(function: String, line: Int, error: Error)

/// Name of the pixel event
Expand Down Expand Up @@ -348,6 +350,9 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case .networkProtectionConfigurationFailedToParse:
return "netp_ev_configuration_failed_to_parse"

case .networkProtectionMalformedErrorDetected:
return "netp_malformed_error_detected"

case .networkProtectionUnhandledError:
return "netp_unhandled_error"
}
Expand Down Expand Up @@ -466,7 +471,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionDNSUpdateCustom,
.networkProtectionDNSUpdateDefault,
.networkProtectionConfigurationInvalidPayload,
.networkProtectionConfigurationPixelTest:
.networkProtectionConfigurationPixelTest,
.networkProtectionMalformedErrorDetected:
return nil
}
}
Expand Down Expand Up @@ -495,7 +501,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionSystemExtensionActivationFailure(let error),
.networkProtectionServerMigrationFailure(let error),
.networkProtectionConfigurationErrorLoadingCachedConfig(let error),
.networkProtectionConfigurationFailedToParse(let error):
.networkProtectionConfigurationFailedToParse(let error),
.networkProtectionMalformedErrorDetected(let error):
return error
case .networkProtectionActiveUser,
.networkProtectionNewUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
NetworkProtectionPixelEvent.networkProtectionTunnelStartAttemptOnDemandWithoutAccessToken,
frequency: .dailyAndCount,
includeAppVersionParameter: true)
case .malformedErrorDetected(let error):
PixelKit.fire(
NetworkProtectionPixelEvent.networkProtectionMalformedErrorDetected(error),
frequency: .dailyAndCount,
includeAppVersionParameter: true)
}
}

Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "202.4.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
.package(path: "../Freemium"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "202.4.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "202.4.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down

0 comments on commit 9184e92

Please sign in to comment.