Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phishing Detection Feature Preferences View #3196

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e467e1c
Add phishing detection data, preferences + state
not-a-rootkit Aug 30, 2024
6db217f
Add detection preferences
not-a-rootkit Aug 30, 2024
c03349a
Add phishing detection to special error page tab extension.
not-a-rootkit Aug 30, 2024
14f8458
Add PhishingDetection folder.
not-a-rootkit Aug 30, 2024
d1124ff
Add URLTokenValidator
not-a-rootkit Aug 30, 2024
ce2983d
Ensure phishing flagged sites aren't added to history
not-a-rootkit Aug 30, 2024
047f5bb
Add redirect to duck://error on phishing detected
not-a-rootkit Aug 30, 2024
250dc18
Update PrivacyInfo.isPhishing when phishing detected
not-a-rootkit Aug 30, 2024
e4059c7
Add DuckURLSchemeHandler for phishing error page
not-a-rootkit Aug 30, 2024
47d0c7c
Load SpecialErrorPage HTML in loadErrorHTML
not-a-rootkit Aug 30, 2024
af65c25
Update phishingErrorData for UserScript
not-a-rootkit Aug 31, 2024
9d6f0e3
Add error page tab title
not-a-rootkit Aug 31, 2024
60138d3
Update favicon + tab title in TabViewModel
not-a-rootkit Aug 31, 2024
c9a9683
Add alert-red colors (as defined in ship review)
not-a-rootkit Aug 31, 2024
6d4a843
Update address bar buttons when phishing error page clicked through.
not-a-rootkit Aug 31, 2024
0f81e17
Add preferences UserText
not-a-rootkit Sep 3, 2024
f157561
Add phishingDetectionPreferences + rename feature flag for error page.
not-a-rootkit Sep 3, 2024
28e8c95
Add preferences localizables.
not-a-rootkit Sep 3, 2024
2b37d16
Rename phishingDetectionErrorPage feature flag.
not-a-rootkit Sep 3, 2024
215a8ba
Add Preferences Views.
not-a-rootkit Sep 3, 2024
f0e44a4
Swiftlint Fix
not-a-rootkit Sep 3, 2024
a9e3376
Swiftlint Fix
not-a-rootkit Sep 3, 2024
742aa71
Merge branch 'tespach/phishing-detection-checker' into tespach/phishi…
not-a-rootkit Sep 3, 2024
4a222ad
Merge branch 'tespach/phishing-error-scheme' into tespach/phishing-pr…
not-a-rootkit Sep 3, 2024
2c3fa1c
Merge branch 'tespach/phishing-privacy-dashboard' into tespach/phishi…
not-a-rootkit Sep 3, 2024
a86e420
Merge branch 'tespach/phishing-detection-integration' into tespach/ph…
not-a-rootkit Sep 5, 2024
f484193
Resolve merge conflicts.
not-a-rootkit Sep 5, 2024
f42f072
Merge branch 'tespach/phishing-detection-integration' into tespach/ph…
not-a-rootkit Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ struct UserText {

static let downloadsOpenPopupOnCompletion = NSLocalizedString("downloads.open.on.completion", value: "Automatically open the Downloads panel when downloads complete", comment: "Checkbox to open a Download Manager popover when downloads are completed")

static let phishingDetectionHeader = NSLocalizedString("phishing-detection.enabled.header", value: "Malicious Site Protection", comment: "Header for phishing site protection section in the settings page")
static let phishingDetectionIsEnabled = NSLocalizedString("phishing-detection.enabled.checkbox", value: "Allow DuckDuckGo to warn you before loading a webpage that has been flagged as malicious or fraudulent.", comment: "Checkbox that enables or disables the phishing detection feature in the browser")
static let phishingDetectionEnabledWarning = NSLocalizedString("phishing-detection.enabled.warning", value: "Disabling this feature can put your personal information at risk. Only do so if you fully understand the risk involved.", comment: "A description box to warn users away from disabling phishing protection")

// MARK: Password Manager
static let passwordManagementAllItems = NSLocalizedString("passsword.management.all-items", value: "All Items", comment: "Used as title for the Autofill All Items option")
static let passwordManagementLogins = NSLocalizedString("passsword.management.logins", value: "Passwords", comment: "Used as title for the Autofill Logins option")
Expand Down
7 changes: 5 additions & 2 deletions DuckDuckGo/FeatureFlagging/Model/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import BrowserServicesKit
public enum FeatureFlag: String {
case debugMenu
case sslCertificatesBypass
case phishingDetection
case phishingDetectionErrorPage
case phishingDetectionPreferences

/// Add experimental atb parameter to SERP queries for internal users to display Privacy Reminder
/// https://app.asana.com/0/1199230911884351/1205979030848528/f
Expand Down Expand Up @@ -53,8 +54,10 @@ extension FeatureFlag: FeatureFlagSourceProviding {
return .remoteReleasable(.subfeature(AutofillSubfeature.unknownUsernameCategorization))
case .freemiumPIR:
return .remoteDevelopment(.subfeature(DBPSubfeature.freemium))
case .phishingDetection:
case .phishingDetectionErrorPage:
return .remoteReleasable(.subfeature(PhishingDetectionSubfeature.allowErrorPage))
case .phishingDetectionPreferences:
return .remoteReleasable(.subfeature(PhishingDetectionSubfeature.allowPreferencesToggle))
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -41242,6 +41242,42 @@
}
}
},
"phishing-detection.enabled.checkbox" : {
"comment" : "Checkbox that enables or disables the phishing detection feature in the browser",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Allow DuckDuckGo to warn you before loading a webpage that has been flagged as malicious or fraudulent."
}
}
}
},
"phishing-detection.enabled.header" : {
"comment" : "Header for phishing site protection section in the settings page",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Malicious Site Protection"
}
}
}
},
"phishing-detection.enabled.warning" : {
"comment" : "A description box to warn users away from disabling phishing protection",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Disabling this feature can put your personal information at risk. Only do so if you fully understand the risk involved."
}
}
}
},
"phishing.error.page.tab.title" : {
"comment" : "Title shown in an error page tab that warn users of security risks on a website that has been flagged as malicious.",
"extractionState" : "extracted_with_value",
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/PhishingDetection/PhishingDetection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class PhishingDetection: PhishingSiteDetecting {
}

private func startUpdateTasksIfEnabled() {
if featureFlagger.isFeatureOn(.phishingDetection),
if featureFlagger.isFeatureOn(.phishingDetectionErrorPage),
self.detectionPreferences.isEnabled {
startUpdateTasks()
}
Expand Down
16 changes: 16 additions & 0 deletions DuckDuckGo/Preferences/View/PreferencesGeneralView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ extension Preferences {
@ObservedObject var searchModel: SearchPreferences
@ObservedObject var tabsModel: TabsPreferences
@ObservedObject var dataClearingModel: DataClearingPreferences
@ObservedObject var phishingDetectionModel: PhishingDetectionPreferences
@State private var showingCustomHomePageSheet = false
@State private var isAddedToDock = false
var dockCustomizer: DockCustomizer
let featureFlagger = NSApp.delegateTyped.featureFlagger

var body: some View {
PreferencePane(UserText.general) {
Expand Down Expand Up @@ -190,6 +192,20 @@ extension Preferences {
isOn: $downloadsModel.alwaysRequestDownloadLocation)
}
}

// SECTION 7: Phishing Detection
if featureFlagger.isFeatureOn(.phishingDetectionPreferences) {
PreferencePaneSection(UserText.phishingDetectionHeader) {
PreferencePaneSubSection {
ToggleMenuItem(UserText.phishingDetectionIsEnabled,
isOn: $phishingDetectionModel.isEnabled)
}.padding(.bottom, 5)
Text(UserText.phishingDetectionEnabledWarning)
.font(.footnote)
.foregroundColor(.red)
.padding(.top, 5)
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Preferences/View/PreferencesRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enum Preferences {
searchModel: SearchPreferences.shared,
tabsModel: TabsPreferences.shared,
dataClearingModel: DataClearingPreferences.shared,
dockCustomizer: DockCustomizer())
phishingDetectionModel: PhishingDetectionPreferences.shared, dockCustomizer: DockCustomizer())
case .sync:
SyncView()
case .appearance:
Expand Down
Loading