From 55ecd9bd8f491d06f98be58c6bf4a73f88be8032 Mon Sep 17 00:00:00 2001 From: Trikolon Date: Fri, 17 Nov 2023 17:36:49 +0100 Subject: [PATCH 1/4] Allow empty rules for disabling CBH for specific sites. --- test/validateRules.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/test/validateRules.js b/test/validateRules.js index c8b14a1..85f11b4 100644 --- a/test/validateRules.js +++ b/test/validateRules.js @@ -88,22 +88,5 @@ const ajv = new Ajv({ loadSchema, allErrors: true }); exitWithError("Found duplicate rules"); } - // 4. Check for empty rules that have no click or cookie injection rule. - // Allow detect-only click rules that only have a presence field. - let foundEmptyRules = false; - ruleList.data.forEach((rule, i) => { - if ( - !rule.cookies?.optIn?.length && - !rule.cookies?.optOut?.length && - !rule.click?.presence - ) { - console.error(`Empty rule rule #${i} id: ${rule.id}`); - foundEmptyRules = true; - } - }); - if (foundEmptyRules) { - exitWithError("Found empty rules"); - } - console.info(`✅ ${RULE_LIST_FILE} is valid.`); })(); From 080aac63719d78deb6d3e0b8633edcb097f4f87d Mon Sep 17 00:00:00 2001 From: Trikolon Date: Fri, 17 Nov 2023 17:42:46 +0100 Subject: [PATCH 2/4] Add a "disabled" rule with paypal and tumblr. Adding domains to an empty rule means the cookie banner handling mechanism won't run for these sites. We're removing tumblr.com and paypal.com specifically to ensure we don't significantly decrease performance on these sites. They may be added back in the future. --- cookie-banner-rules-list.json | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/cookie-banner-rules-list.json b/cookie-banner-rules-list.json index 69936e1..a082b5e 100644 --- a/cookie-banner-rules-list.json +++ b/cookie-banner-rules-list.json @@ -81,6 +81,10 @@ "skipPresenceVisibilityCheck": true } }, + { + "id": "disabled", + "domains": ["tumblr.com", "paypal.com"] + }, { "click": { "optIn": "button.btn-accept", @@ -606,23 +610,6 @@ "id": "31dc6160-3495-4f4e-8c67-594527bd4051", "domains": ["bing.com"] }, - { - "click": { - "optIn": "button#acceptAllButton", - "optOut": "button#bannerDeclineButton", - "presence": "div#gdprCookieBanner" - }, - "cookies": { - "optOut": [ - { - "name": "cookie_prefs", - "value": "T%3D0%2CP%3D0%2CF%3D0%2Ctype%3Dexplicit_banner" - } - ] - }, - "id": "3f1e21e7-327f-42de-ac40-25da7f4fa7c9", - "domains": ["paypal.com"] - }, { "click": {}, "cookies": { @@ -666,17 +653,6 @@ "id": "37319f5d-9484-4da8-aee1-570a78688da3", "domains": ["yandex.com", "yandex.ru", "ya.ru", "kinopoisk.ru"] }, - { - "click": {}, - "cookies": { - "optOut": [ - { "name": "euconsent-v2", "value": "1" }, - { "name": "euconsent-v2-noniab", "value": "AAYA" } - ] - }, - "id": "e8f941e6-ac56-4dec-b682-a75e8bd52aae", - "domains": ["tumblr.com"] - }, { "click": {}, "cookies": { From a4b8b7d985f6c451ba4927f113757b3018d5d62c Mon Sep 17 00:00:00 2001 From: Trikolon Date: Fri, 17 Nov 2023 17:44:36 +0100 Subject: [PATCH 3/4] Remove broken Amazon rule. See: Intermittent failure to handle Amazon #273 --- cookie-banner-rules-list.json | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/cookie-banner-rules-list.json b/cookie-banner-rules-list.json index a082b5e..357ed6a 100644 --- a/cookie-banner-rules-list.json +++ b/cookie-banner-rules-list.json @@ -83,7 +83,17 @@ }, { "id": "disabled", - "domains": ["tumblr.com", "paypal.com"] + "domains": [ + "tumblr.com", + "paypal.com", + "amazon.se", + "amazon.fr", + "amazon.nl", + "amazon.es", + "amazon.co.uk", + "amazon.de", + "amazon.it" + ] }, { "click": { @@ -2427,24 +2437,6 @@ "id": "eb274e15-29fe-4004-9e6d-27046bd0b82d", "domains": ["td.com"] }, - { - "click": { - "optIn": "span.a-button-inner", - "optOut": "a#sp-cc-rejectall-link", - "presence": "form#sp-cc" - }, - "cookies": {}, - "id": "1653780d-92d7-4677-acb0-6427a7bbdeba", - "domains": [ - "amazon.se", - "amazon.fr", - "amazon.nl", - "amazon.es", - "amazon.co.uk", - "amazon.de", - "amazon.it" - ] - }, { "click": { "optIn": "button.fc-cta-consent", From 54b84b02d7669ab40a0a106040549128d70d7245 Mon Sep 17 00:00:00 2001 From: Trikolon Date: Fri, 17 Nov 2023 19:39:34 +0100 Subject: [PATCH 4/4] Add the validation check for empty rules back, but exclude the disabled rule explicitly. --- test/validateRules.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/validateRules.js b/test/validateRules.js index 85f11b4..2468583 100644 --- a/test/validateRules.js +++ b/test/validateRules.js @@ -10,6 +10,9 @@ const { exit } = require("process"); const RULE_LIST_FILE = "cookie-banner-rules-list.json"; +// ID of the rule which contains sites where the mechanism is disabled. +const RULE_ID_DISABLED = "disabled"; + let fetch; /** @@ -88,5 +91,25 @@ const ajv = new Ajv({ loadSchema, allErrors: true }); exitWithError("Found duplicate rules"); } + // 4. Check for empty rules that have no click or cookie injection rule. + // Allow detect-only click rules that only have a presence field. + // Also allow the "disabled" rule which contains all sites the mechanism is + // disabled for. + let foundEmptyRules = false; + ruleList.data.forEach((rule, i) => { + if ( + rule.id !== RULE_ID_DISABLED && + !rule.cookies?.optIn?.length && + !rule.cookies?.optOut?.length && + !rule.click?.presence + ) { + console.error(`Empty rule rule #${i} id: ${rule.id}`); + foundEmptyRules = true; + } + }); + if (foundEmptyRules) { + exitWithError("Found empty rules"); + } + console.info(`✅ ${RULE_LIST_FILE} is valid.`); })();