From b258984025cd084b2d1e3d821789e1a3196e4047 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Thu, 27 Apr 2023 10:51:57 +0100 Subject: [PATCH] Validate that third party trackers load correctly Requires: https://github.com/duckduckgo/privacy-test-pages/pull/158 --- .../data/configs/storage-blocking.json | 15 +++++++++++++++ integration-test/storage-blocking.spec.js | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/integration-test/data/configs/storage-blocking.json b/integration-test/data/configs/storage-blocking.json index 033f650e99..f531517a31 100644 --- a/integration-test/data/configs/storage-blocking.json +++ b/integration-test/data/configs/storage-blocking.json @@ -1,4 +1,19 @@ { + "globalThis.dbg.tds.config.features.trackerAllowlist": { + "allowlistedTrackers": { + "ad-company.site": { + "rules": [ + { + "rule": "convert.ad-company.site", + "domains": [ + "" + ], + "reason": "Validation of the cookie rules and not blocking" + } + ] + } + } + }, "globalThis.dbg.tds.config.features.trackingCookies3p": { "state": "enabled", "exceptions": [ ], diff --git a/integration-test/storage-blocking.spec.js b/integration-test/storage-blocking.spec.js index 7a238287fa..49958a5428 100644 --- a/integration-test/storage-blocking.spec.js +++ b/integration-test/storage-blocking.spec.js @@ -6,6 +6,7 @@ import { routeFromLocalhost } from './helpers/testPages' const testPageDomain = 'privacy-test-pages.glitch.me' const thirdPartyDomain = 'good.third-party.site' const thirdPartyTracker = 'broken.third-party.site' +const thirdPartyAd = 'convert.ad-company.site' async function waitForAllResults (page) { while ((await page.$$('#tests-details > li > span > ul')).length < 2) { @@ -40,6 +41,11 @@ test.describe('Storage blocking Tests', () => { thirdparty_firstparty_headerdata: expectUnmodified('allows 1st party HTTP cookies from non-tracker frames'), jsdata: expectUnmodified('does not block 3rd party JS cookies not on block list') }, + [thirdPartyAd]: { + top_thirdparty_headerdata: expectUnmodified('allows 3rd party HTTP cookies not on block list'), + thirdparty_firstparty_headerdata: expectUnmodified('allows 1st party HTTP cookies from non-tracker frames'), + jsdata: expectUnmodified('does not block 3rd party JS cookies not on block list') + }, [thirdPartyTracker]: { thirdpartytracker_thirdparty_headerdata: expectUnmodified('allows 3rd party tracker HTTP cookies from tracker frames'), top_tracker_headerdata: expectBlocked('blocks 3rd party HTTP cookies for trackers'), @@ -55,6 +61,11 @@ test.describe('Storage blocking Tests', () => { if (jsCookies.has(cookie.name)) { expect(cookie.expires - nowSeconds).toBeGreaterThan(0) expect(cookie.expires - nowSeconds).toBeLessThan(604800) + if (cookie.domain === thirdPartyTracker) { + expect(cookie.expires - nowSeconds).toBeLessThan(86400) + } else { + expect(cookie.expires - nowSeconds).toBeGreaterThan(86400) + } } } })