Control debug masking via diagnostics

Be clear about NOT logging any sensitive data. In fact, the
variable name masksPrivateData is potentially misleading.
This commit is contained in:
Davide De Rosa 2019-03-21 21:31:13 +01:00
parent 9f6307dbc2
commit 96f5210c7c
6 changed files with 29 additions and 1 deletions

View File

@ -397,6 +397,11 @@ class ServiceViewController: UIViewController, TableModelHost {
self.present(alert, animated: true, completion: nil)
}
}
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
AppConstants.VPN.baseConfiguration.masksPrivateData = cell.isOn
service.baseConfiguration = AppConstants.VPN.baseConfiguration.build()
}
private func postSupportRequest() {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
@ -493,6 +498,8 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case debugLog
case masksPrivateData
case joinCommunity
case reportIssue
@ -705,6 +712,12 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
cell.leftText = L10n.Service.Cells.DebugLog.caption
return cell
case .masksPrivateData:
let cell = Cells.toggle.dequeue(from: tableView, for: indexPath, tag: row.rawValue, delegate: self)
cell.caption = L10n.Service.Cells.MasksPrivateData.caption
cell.isOn = AppConstants.VPN.baseConfiguration.masksPrivateData ?? true
return cell
// feedback
case .joinCommunity:
@ -859,6 +872,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case .trustedPolicy:
toggleTrustedConnectionPolicy(cell.isOn, sender: cell)
case .masksPrivateData:
togglePrivateDataMasking(cell: cell)
default:
break
}
@ -922,6 +938,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
}
model.setFooter(L10n.Service.Sections.VpnSurvivesSleep.footer, for: .vpnSurvivesSleep)
model.setFooter(L10n.Service.Sections.Trusted.footer, for: .trustedPolicy)
model.setFooter(L10n.Service.Sections.Diagnostics.footer, for: .diagnostics)
}
// rows
@ -947,7 +964,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
}
model.set([.vpnSurvivesSleep], in: .vpnSurvivesSleep)
model.set([.trustedPolicy], in: .trustedPolicy)
model.set([.dataCount, .debugLog], in: .diagnostics)
model.set([.dataCount, .debugLog, .masksPrivateData], in: .diagnostics)
model.set([.joinCommunity, .reportIssue], in: .feedback)
}

View File

@ -79,6 +79,7 @@
"service.sections.trusted.header" = "Trusted networks";
"service.sections.trusted.footer" = "When entering a trusted network, the VPN is normally shut down and kept disconnected. Disable this option to not enforce such behavior.";
"service.sections.diagnostics.header" = "Diagnostics";
"service.sections.diagnostics.footer" = "Masking status will be effective after reconnecting. Network data is hostnames, IP addresses, routing, SSID. Credentials and private keys are not logged regardless.";
//"service.sections.destruction.footer" = "Delete configuration from device settings.";
"service.cells.use_profile.caption" = "Use this profile";
@ -106,6 +107,7 @@
"service.cells.test_connectivity.caption" = "Test connectivity";
"service.cells.data_count.caption" = "Exchanged bytes count";
"service.cells.debug_log.caption" = "Debug log";
"service.cells.masks_private_data.caption" = "Mask network data";
"service.cells.report_issue.caption" = "Report connectivity issue";
"service.alerts.rename.title" = "Rename profile";

View File

@ -55,6 +55,7 @@ public class AppConstants {
// builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
// builder.debugLogFormat = "$DHH:mm:ss$d $N.$F:$l - $M"
builder.debugLogFormat = Log.debugFormat
builder.masksPrivateData = true
return builder
}()

View File

@ -62,6 +62,7 @@ public class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
builder.mtu = configuration.mtu
builder.shouldDebug = configuration.shouldDebug
builder.debugLogFormat = configuration.debugLogFormat
builder.masksPrivateData = configuration.masksPrivateData
return builder.build()
}

View File

@ -119,6 +119,7 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
builder.mtu = configuration.mtu
builder.shouldDebug = configuration.shouldDebug
builder.debugLogFormat = configuration.debugLogFormat
builder.masksPrivateData = configuration.masksPrivateData
if let address = manualAddress {
builder.prefersResolvedAddresses = true

View File

@ -546,6 +546,10 @@ public enum L10n {
}
}
}
public enum MasksPrivateData {
/// Mask network data
public static let caption = L10n.tr("Localizable", "service.cells.masks_private_data.caption")
}
public enum Provider {
public enum Pool {
/// Location
@ -613,6 +617,8 @@ public enum L10n {
public static let header = L10n.tr("Localizable", "service.sections.configuration.header")
}
public enum Diagnostics {
/// Masking status will be effective after reconnecting. Network data is hostnames, IP addresses, routing, SSID. Credentials and private keys are not logged regardless.
public static let footer = L10n.tr("Localizable", "service.sections.diagnostics.footer")
/// Diagnostics
public static let header = L10n.tr("Localizable", "service.sections.diagnostics.header")
}