From a1890713d0e08d2a68f7c6d6c8ac995c4f2e183b Mon Sep 17 00:00:00 2001 From: Anh Do Date: Thu, 21 Mar 2024 18:05:08 -0400 Subject: [PATCH 1/2] Use anonymousDescription for lastPathChange --- ...etworkProtectionTunnelFailureMonitor.swift | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift index 654269fbd..5b6dbd578 100644 --- a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift +++ b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift @@ -84,7 +84,7 @@ public actor NetworkProtectionTunnelFailureMonitor { firstCheckSkipped = false networkMonitor.pathUpdateHandler = { path in - callback(.networkPathChanged(path.debugDescription)) + callback(.networkPathChanged(path.anonymousDescription)) } task = Task.periodic(interval: Self.monitoringInterval) { [weak self] in @@ -142,3 +142,27 @@ public actor NetworkProtectionTunnelFailureMonitor { return [.wifi, .eth, .cellular].contains(connectionType) && path.status == .satisfied } } + +extension Network.NWPath { + /// A description that's safe from a privacy standpoint. + /// + /// Ref: https://app.asana.com/0/0/1206712493935053/1206712516729780/f + /// + public var anonymousDescription: String { + var description = "NWPath(" + + description += "status: \(status), " + + if #available(iOS 14.2, *), case .unsatisfied = status { + description += "unsatisfiedReason: \(unsatisfiedReason), " + } + + description += "availableInterfaces: \(availableInterfaces), " + description += "isConstrained: \(isConstrained ? "true" : "false"), " + description += "isExpensive: \(isExpensive ? "true" : "false")" + description += ")" + + return description + } +} + From 6b8376778ef2e3694c448a77e798a964b6c80929 Mon Sep 17 00:00:00 2001 From: Anh Do Date: Thu, 21 Mar 2024 18:11:48 -0400 Subject: [PATCH 2/2] Fix swiftlint --- .../Diagnostics/NetworkProtectionTunnelFailureMonitor.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift index 5b6dbd578..12d92a7ff 100644 --- a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift +++ b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift @@ -165,4 +165,3 @@ extension Network.NWPath { return description } } -