Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Replace old privacy page with new - MacOS #1611

Merged
merged 15 commits into from
Sep 27, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
{
"identity" : "trackerradarkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/TrackerRadarKit",
"location" : "https://github.com/duckduckgo/TrackerRadarKit.git",
"state" : {
"revision" : "4684440d03304e7638a2c8086895367e90987463",
"version" : "1.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import BrowserServicesKit
final class AppPrivacyConfigurationDataProvider: EmbeddedDataProvider {

public struct Constants {
public static let embeddedDataETag = "\"076b425659344a2de5a89f491574acd1\""
public static let embeddedDataSHA = "f3ffc1e8d31228abbc97adede3e25bc8cabaff18d6b9cacc61ab135ca525d432"
public static let embeddedDataETag = "\"3c5698bbe5ae3ea13aa7e0c6916e13fa\""
public static let embeddedDataSHA = "b332ca5a8f110cb592f9d875e57ca9e6ac8edad498003eedea11ea3946167570"
}

var embeddedDataEtag: String {
Expand Down
81 changes: 77 additions & 4 deletions DuckDuckGo/ContentBlocker/macos-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"readme": "https://github.com/duckduckgo/privacy-configuration",
"version": 1695630192250,
"version": 1695811101316,
"features": {
"adClickAttribution": {
"readme": "https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/#3rd-party-tracker-loading-protection",
Expand Down Expand Up @@ -313,10 +313,70 @@
{
"domain": "roll20.net",
"reason": "Performance issue for too many fields."
},
{
"domain": "amazon.ca",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.cn",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.co.jp",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.com",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.com.au",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.com.mx",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.co.uk",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.de",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.es",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.eu",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.fr",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.in",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.it",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.nl",
"reason": "Performance issue, infinite loop."
},
{
"domain": "amazon.sa",
"reason": "Performance issue, infinite loop."
}
],
"state": "enabled",
"hash": "59c4bd9b8cee343c81da98bfe5d77928"
"hash": "2c000369279a9265b5247070e841be2d"
},
"clickToLoad": {
"exceptions": [
Expand Down Expand Up @@ -4252,11 +4312,24 @@
"state": "enabled",
"features": {
"rollout": {
"state": "disabled"
"state": "enabled",
"rollout": {
"steps": [
{
"percent": 1
},
{
"percent": 5
},
{
"percent": 15
}
]
}
}
},
"exceptions": [],
"hash": "54776d4aa010391dc14a53ad69cd1777"
"hash": "39a36ca9002bd5aea4dd7b6bdb5b79d4"
},
"navigatorInterface": {
"exceptions": [
Expand Down
10 changes: 5 additions & 5 deletions IntegrationTests/AutoconsentIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AutoconsentIntegrationTests: XCTestCase {
func testWhenAutoconsentEnabled_cookieConsentManaged() async throws {
// enable the feature
PrivacySecurityPreferences.shared.autoconsentEnabled = true
let url = URL(string: "http://privacy-test-pages.glitch.me/features/autoconsent/")!
let url = URL(string: "http://privacy-test-pages.site/features/autoconsent/")!

let tab = self.tabViewModel.tab

Expand All @@ -83,7 +83,7 @@ class AutoconsentIntegrationTests: XCTestCase {
func testWhenAutoconsentDisabled_promptIsDisplayed() async throws {
// reset the feature setting
PrivacySecurityPreferences.shared.autoconsentEnabled = nil
let url = URL(string: "http://privacy-test-pages.glitch.me/features/autoconsent/")!
let url = URL(string: "http://privacy-test-pages.site/features/autoconsent/")!

let tab = self.tabViewModel.tab

Expand Down Expand Up @@ -113,7 +113,7 @@ class AutoconsentIntegrationTests: XCTestCase {
func testCosmeticRule_whenFakeCookieBannerIsDisplayed_bannerIsHidden() async throws {
// enable the feature
PrivacySecurityPreferences.shared.autoconsentEnabled = true
let url = URL(string: "http://privacy-test-pages.glitch.me/features/autoconsent/banner.html")!
let url = URL(string: "http://privacy-test-pages.site/features/autoconsent/banner.html")!

let tab = self.tabViewModel.tab
// expect `cosmetic` to be published
Expand Down Expand Up @@ -164,7 +164,7 @@ class AutoconsentIntegrationTests: XCTestCase {
func testCosmeticRule_whenFakeCookieBannerIsDisplayedAndScriptsAreReloaded_bannerIsHidden() async throws {
// enable the feature
PrivacySecurityPreferences.shared.autoconsentEnabled = true
let url = URL(string: "http://privacy-test-pages.glitch.me/features/autoconsent/banner.html")!
let url = URL(string: "http://privacy-test-pages.site/features/autoconsent/banner.html")!

let tab = self.tabViewModel.tab
// expect `cosmetic` to be published
Expand All @@ -181,7 +181,7 @@ class AutoconsentIntegrationTests: XCTestCase {
.first()
.promise()

os_log("starting navigation to http://privacy-test-pages.glitch.me/features/autoconsent/banner.html")
os_log("starting navigation to http://privacy-test-pages.site/features/autoconsent/banner.html")
let navigation = await tab.setUrl(url, userEntered: nil)?.value

navigation?.appendResponder(navigationResponse: { response in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class HTTPSUpgradeIntegrationTests: XCTestCase {

window = WindowsManager.openNewWindow(with: .none)!

XCTAssertTrue(AppPrivacyFeatures.shared.contentBlocking.privacyConfigurationManager.privacyConfig.isFeature(.httpsUpgrade, enabledForDomain: "privacy-test-pages.glitch.me"))
XCTAssertTrue(AppPrivacyFeatures.shared.contentBlocking.privacyConfigurationManager.privacyConfig.isFeature(.httpsUpgrade, enabledForDomain: "privacy-test-pages.site"))
await ConfigurationManager.shared.refreshIfNeeded()?.value
}

Expand All @@ -59,7 +59,7 @@ class HTTPSUpgradeIntegrationTests: XCTestCase {
var persistor = DownloadsPreferencesUserDefaultsPersistor()
persistor.selectedDownloadLocation = FileManager.default.temporaryDirectory.absoluteString

let url = URL(string: "http://privacy-test-pages.glitch.me/privacy-protections/https-upgrades/")!
let url = URL(string: "http://privacy-test-pages.site/privacy-protections/https-upgrades/")!
let upgradableUrl = URL(string: "http://good.third-party.site/privacy-protections/https-upgrades/frame.html")!
let upgradedUrl = try? await AppPrivacyFeatures.shared.httpsUpgrade.upgrade(url: upgradableUrl).get()
XCTAssertEqual(upgradedUrl, upgradableUrl.toHttps()!, "URL not upgraded")
Expand Down Expand Up @@ -119,7 +119,7 @@ class HTTPSUpgradeIntegrationTests: XCTestCase {
var persistor = DownloadsPreferencesUserDefaultsPersistor()
persistor.selectedDownloadLocation = FileManager.default.temporaryDirectory.absoluteString

let url = URL(string: "http://privacy-test-pages.glitch.me/privacy-protections/https-loop-protection/")!
let url = URL(string: "http://privacy-test-pages.site/privacy-protections/https-loop-protection/")!

let tabViewModel = self.tabViewModel
let tab = tabViewModel.tab
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/History/HistoryIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class HistoryIntegrationTests: XCTestCase {
let tab = Tab(content: .homePage)
window = WindowsManager.openNewWindow(with: tab)!

let url = URL(string: "http://privacy-test-pages.glitch.me/tracker-reporting/1major-via-script.html")!
let url = URL(string: "http://privacy-test-pages.site/tracker-reporting/1major-via-script.html")!

// navigate to a regular page, tracker count should be reset to 0
let trackerPromise = tab.privacyInfoPublisher.compactMap { $0?.$trackerInfo }
Expand Down Expand Up @@ -217,7 +217,7 @@ class HistoryIntegrationTests: XCTestCase {
let tab = Tab(content: .homePage)
window = WindowsManager.openNewWindow(with: tab)!

let url = URL(string: "http://privacy-test-pages.glitch.me/tracker-reporting/1major-with-surrogate.html")!
let url = URL(string: "http://privacy-test-pages.site/tracker-reporting/1major-with-surrogate.html")!

// navigate to a regular page, tracker count should be reset to 0
let trackerPromise = tab.privacyInfoPublisher.compactMap { $0?.$trackerInfo }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
let tab = Tab(content: .none, extensionsBuilder: extensionsBuilder)
window = WindowsManager.openNewWindow(with: tab)!

let url = URL(string: "https://privacy-test-pages.glitch.me/privacy-protections/amp/")!
let url = URL(string: "https://privacy-test-pages.site/privacy-protections/amp/")!
_=try await tab.setUrl(url, userEntered: nil)?.value?.result.get()

let itemsCount = try await tab.webView.evaluateJavaScript("document.getElementsByTagName('li').length") as? Int ?? 0
Expand Down Expand Up @@ -148,7 +148,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
let tab = Tab(content: .none, extensionsBuilder: extensionsBuilder)
window = WindowsManager.openNewWindow(with: tab)!

let url = URL(string: "https://privacy-test-pages.glitch.me/privacy-protections/referrer-trimming/")!
let url = URL(string: "https://privacy-test-pages.site/privacy-protections/referrer-trimming/")!
_=try await tab.setUrl(url, userEntered: nil)?.value?.result.get()

// run test
Expand Down Expand Up @@ -188,9 +188,9 @@ class NavigationProtectionIntegrationTests: XCTestCase {
XCTAssertTrue(results.count > 0)
for result in results {
if result.id.hasPrefix("1p") {
XCTAssertEqual(result.value?.string, "https://privacy-test-pages.glitch.me/privacy-protections/referrer-trimming/", result.id)
XCTAssertEqual(result.value?.string, "https://privacy-test-pages.site/privacy-protections/referrer-trimming/", result.id)
} else {
XCTAssertEqual(result.value?.string, "https://privacy-test-pages.glitch.me/", result.id)
XCTAssertEqual(result.value?.string, "https://privacy-test-pages.site/", result.id)
}
}
}
Expand All @@ -201,7 +201,7 @@ class NavigationProtectionIntegrationTests: XCTestCase {
window = WindowsManager.openNewWindow(with: tab)!
let tabViewModel = (window.contentViewController as! MainViewController).browserTabViewController.tabViewModel!

let url = URL(string: "https://privacy-test-pages.glitch.me/privacy-protections/gpc/")!
let url = URL(string: "https://privacy-test-pages.site/privacy-protections/gpc/")!
// disable GPC redirects
PrivacySecurityPreferences.shared.gpcEnabled = false
_=try await tab.setUrl(url, userEntered: nil)?.value?.result.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class PrivacyDashboardIntegrationTests: XCTestCase {
.promise()

// load the test page
let url = URL(string: "http://privacy-test-pages.glitch.me/tracker-reporting/1major-via-script.html")!
let url = URL(string: "http://privacy-test-pages.site/tracker-reporting/1major-via-script.html")!
_=await tab.setUrl(url, userEntered: nil)?.value?.result

let trackersCount = try await trackersCountPromise.value
Expand Down
2 changes: 1 addition & 1 deletion scripts/update_embedded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eo pipefail

TDS_URL="https://staticcdn.duckduckgo.com/trackerblocking/v5/current/macos-tds.json"
CONFIG_URL="https://staticcdn.duckduckgo.com/trackerblocking/config/v2/macos-config.json"
CONFIG_URL="https://staticcdn.duckduckgo.com/trackerblocking/config/v3/macos-config.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it desired?

Copy link
Contributor

@brindy brindy Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# If -c is passed, then check the URLs in the Configuration files are correct.
if [ "$1" == "-c" ]; then
Expand Down