@duckduckgo/autoconsent 6.7.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v7.0.0 (Thu Dec 28 2023)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Fix CSP errors when running eval rules in MV3 extension [#318](https://github.com/duckduckgo/autoconsent/pull/318) ([@muodov](https://github.com/muodov))
6
+
7
+ #### Authors: 1
8
+
9
+ - Maxim Tsoy ([@muodov](https://github.com/muodov))
10
+
11
+ ---
12
+
1
13
  # v6.7.0 (Thu Dec 28 2023)
2
14
 
3
15
  #### 🚀 Enhancement
@@ -2,6 +2,119 @@
2
2
  // lib/config.ts
3
3
  var enableLogs = false;
4
4
 
5
+ // lib/eval-snippets.ts
6
+ var snippets = {
7
+ // code-based rules
8
+ EVAL_0: () => console.log(1),
9
+ EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
10
+ EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
11
+ EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
12
+ EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
13
+ EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
14
+ EVAL_COOKIEBOT_1: () => !!window.Cookiebot,
15
+ EVAL_COOKIEBOT_2: () => !window.Cookiebot.hasResponse && window.Cookiebot.dialog?.visible === true,
16
+ EVAL_COOKIEBOT_3: () => window.Cookiebot.withdraw() || true,
17
+ EVAL_COOKIEBOT_4: () => window.Cookiebot.hide() || true,
18
+ EVAL_COOKIEBOT_5: () => window.Cookiebot.declined === true,
19
+ EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
20
+ EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
21
+ EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
22
+ // declarative rules
23
+ EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
24
+ EVAL_ALMACMP_0: () => document.cookie.includes('"name":"Google","consent":false'),
25
+ EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
26
+ EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
27
+ EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
28
+ EVAL_BLOCKSY_0: () => document.cookie.includes("blocksy_cookies_consent_accepted=no"),
29
+ EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
30
+ EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
31
+ EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
32
+ EVAL_CC_BANNER2_0: () => !!document.cookie.match(/sncc=[^;]+D%3Dtrue/),
33
+ EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
34
+ EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
35
+ EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
36
+ EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
37
+ EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
38
+ EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
39
+ EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
40
+ EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
41
+ EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
42
+ EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
43
+ EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
44
+ EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
45
+ EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
46
+ EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
47
+ EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
48
+ EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
49
+ EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
50
+ EVAL_COOKIEYES_0: () => document.cookie.includes("advertisement:no"),
51
+ EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
52
+ EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
53
+ EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
54
+ EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
55
+ toggle.checked = false;
56
+ }) || true,
57
+ EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
58
+ EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
59
+ EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
60
+ EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
61
+ EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
62
+ EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
63
+ EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
64
+ if (x.checked)
65
+ x.click();
66
+ }) || true,
67
+ EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
68
+ EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
69
+ EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
70
+ EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
71
+ EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
72
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
73
+ EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
74
+ if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
75
+ i.checked = false;
76
+ }) || true,
77
+ EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
78
+ EVAL_OPERA_0: () => document.cookie.includes("cookie_consent_essential=true") && !document.cookie.includes("cookie_consent_marketing=true"),
79
+ EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
80
+ EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
81
+ EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
82
+ EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
83
+ EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
84
+ EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
85
+ EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
86
+ EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
87
+ EVAL_TAKEALOT_0: () => document.body.classList.remove("freeze") || (document.body.style = "") || true,
88
+ EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
89
+ EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
90
+ EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
91
+ EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
92
+ EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
93
+ EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
94
+ EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
95
+ EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
96
+ EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
97
+ EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
98
+ EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
99
+ EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
100
+ EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
101
+ EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
102
+ EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
103
+ EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
104
+ EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
105
+ EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
106
+ EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
107
+ EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
108
+ EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
109
+ EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
110
+ EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
111
+ EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
112
+ EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
113
+ EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
114
+ EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
115
+ EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
116
+ };
117
+
5
118
  // addon/mv-compat.ts
6
119
  var manifestVersion = chrome.runtime.getManifest().manifest_version;
7
120
  var storage = {};
@@ -110,7 +223,7 @@
110
223
  rules: await res.json()
111
224
  });
112
225
  }
113
- async function evalInTab(tabId, frameId, code) {
226
+ async function evalInTab(tabId, frameId, code, snippetId) {
114
227
  if (manifestVersion === 2) {
115
228
  return new Promise((resolve) => {
116
229
  chrome.tabs.executeScript(tabId, {
@@ -130,15 +243,7 @@
130
243
  frameIds: [frameId]
131
244
  },
132
245
  world: "MAIN",
133
- args: [code],
134
- func: (code2) => {
135
- try {
136
- return window.eval(code2);
137
- } catch (e) {
138
- console.warn("eval error", code2, e);
139
- return;
140
- }
141
- }
246
+ func: snippets[snippetId]
142
247
  });
143
248
  }
144
249
  async function getTabReports(tabId) {
@@ -187,7 +292,7 @@
187
292
  });
188
293
  break;
189
294
  case "eval":
190
- evalInTab(tabId, frameId, msg.code).then(([result]) => {
295
+ evalInTab(tabId, frameId, msg.code, msg.snippetId).then(([result]) => {
191
296
  if (enableLogs) {
192
297
  console.groupCollapsed(`eval result for ${sender.origin || sender.url}`);
193
298
  console.log(msg.code, result.result);
@@ -600,12 +600,13 @@
600
600
  pending: /* @__PURE__ */ new Map(),
601
601
  sendContentMessage: null
602
602
  };
603
- function requestEval(code) {
603
+ function requestEval(code, snippetId) {
604
604
  const id = getRandomID();
605
605
  evalState.sendContentMessage({
606
606
  type: "eval",
607
607
  id,
608
- code
608
+ code,
609
+ snippetId
609
610
  });
610
611
  const deferred = new Deferred(id);
611
612
  evalState.pending.set(deferred.id, deferred);
@@ -689,7 +690,7 @@
689
690
  EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
690
691
  EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
691
692
  EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
692
- EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
693
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
693
694
  EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
694
695
  if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
695
696
  i.checked = false;
@@ -777,7 +778,7 @@
777
778
  }
778
779
  const snippetSrc = getFunctionBody(snippet);
779
780
  enableLogs && console.log("async eval:", snippetId, snippetSrc);
780
- return requestEval(snippetSrc).catch((e) => {
781
+ return requestEval(snippetSrc, snippetId).catch((e) => {
781
782
  enableLogs && console.error("error evaluating rule", snippetId, e);
782
783
  return false;
783
784
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Autoconsent",
4
- "version": "2023.12.27",
4
+ "version": "2023.12.28",
5
5
  "background": {
6
6
  "scripts": [
7
7
  "background.bundle.js"
@@ -2,6 +2,119 @@
2
2
  // lib/config.ts
3
3
  var enableLogs = false;
4
4
 
5
+ // lib/eval-snippets.ts
6
+ var snippets = {
7
+ // code-based rules
8
+ EVAL_0: () => console.log(1),
9
+ EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
10
+ EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
11
+ EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
12
+ EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
13
+ EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
14
+ EVAL_COOKIEBOT_1: () => !!window.Cookiebot,
15
+ EVAL_COOKIEBOT_2: () => !window.Cookiebot.hasResponse && window.Cookiebot.dialog?.visible === true,
16
+ EVAL_COOKIEBOT_3: () => window.Cookiebot.withdraw() || true,
17
+ EVAL_COOKIEBOT_4: () => window.Cookiebot.hide() || true,
18
+ EVAL_COOKIEBOT_5: () => window.Cookiebot.declined === true,
19
+ EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
20
+ EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
21
+ EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
22
+ // declarative rules
23
+ EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
24
+ EVAL_ALMACMP_0: () => document.cookie.includes('"name":"Google","consent":false'),
25
+ EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
26
+ EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
27
+ EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
28
+ EVAL_BLOCKSY_0: () => document.cookie.includes("blocksy_cookies_consent_accepted=no"),
29
+ EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
30
+ EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
31
+ EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
32
+ EVAL_CC_BANNER2_0: () => !!document.cookie.match(/sncc=[^;]+D%3Dtrue/),
33
+ EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
34
+ EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
35
+ EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
36
+ EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
37
+ EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
38
+ EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
39
+ EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
40
+ EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
41
+ EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
42
+ EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
43
+ EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
44
+ EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
45
+ EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
46
+ EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
47
+ EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
48
+ EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
49
+ EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
50
+ EVAL_COOKIEYES_0: () => document.cookie.includes("advertisement:no"),
51
+ EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
52
+ EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
53
+ EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
54
+ EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
55
+ toggle.checked = false;
56
+ }) || true,
57
+ EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
58
+ EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
59
+ EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
60
+ EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
61
+ EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
62
+ EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
63
+ EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
64
+ if (x.checked)
65
+ x.click();
66
+ }) || true,
67
+ EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
68
+ EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
69
+ EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
70
+ EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
71
+ EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
72
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
73
+ EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
74
+ if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
75
+ i.checked = false;
76
+ }) || true,
77
+ EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
78
+ EVAL_OPERA_0: () => document.cookie.includes("cookie_consent_essential=true") && !document.cookie.includes("cookie_consent_marketing=true"),
79
+ EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
80
+ EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
81
+ EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
82
+ EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
83
+ EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
84
+ EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
85
+ EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
86
+ EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
87
+ EVAL_TAKEALOT_0: () => document.body.classList.remove("freeze") || (document.body.style = "") || true,
88
+ EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
89
+ EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
90
+ EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
91
+ EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
92
+ EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
93
+ EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
94
+ EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
95
+ EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
96
+ EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
97
+ EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
98
+ EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
99
+ EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
100
+ EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
101
+ EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
102
+ EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
103
+ EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
104
+ EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
105
+ EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
106
+ EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
107
+ EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
108
+ EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
109
+ EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
110
+ EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
111
+ EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
112
+ EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
113
+ EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
114
+ EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
115
+ EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
116
+ };
117
+
5
118
  // addon/mv-compat.ts
6
119
  var manifestVersion = chrome.runtime.getManifest().manifest_version;
7
120
  var storage = {};
@@ -110,7 +223,7 @@
110
223
  rules: await res.json()
111
224
  });
112
225
  }
113
- async function evalInTab(tabId, frameId, code) {
226
+ async function evalInTab(tabId, frameId, code, snippetId) {
114
227
  if (manifestVersion === 2) {
115
228
  return new Promise((resolve) => {
116
229
  chrome.tabs.executeScript(tabId, {
@@ -130,15 +243,7 @@
130
243
  frameIds: [frameId]
131
244
  },
132
245
  world: "MAIN",
133
- args: [code],
134
- func: (code2) => {
135
- try {
136
- return window.eval(code2);
137
- } catch (e) {
138
- console.warn("eval error", code2, e);
139
- return;
140
- }
141
- }
246
+ func: snippets[snippetId]
142
247
  });
143
248
  }
144
249
  async function getTabReports(tabId) {
@@ -187,7 +292,7 @@
187
292
  });
188
293
  break;
189
294
  case "eval":
190
- evalInTab(tabId, frameId, msg.code).then(([result]) => {
295
+ evalInTab(tabId, frameId, msg.code, msg.snippetId).then(([result]) => {
191
296
  if (enableLogs) {
192
297
  console.groupCollapsed(`eval result for ${sender.origin || sender.url}`);
193
298
  console.log(msg.code, result.result);
@@ -600,12 +600,13 @@
600
600
  pending: /* @__PURE__ */ new Map(),
601
601
  sendContentMessage: null
602
602
  };
603
- function requestEval(code) {
603
+ function requestEval(code, snippetId) {
604
604
  const id = getRandomID();
605
605
  evalState.sendContentMessage({
606
606
  type: "eval",
607
607
  id,
608
- code
608
+ code,
609
+ snippetId
609
610
  });
610
611
  const deferred = new Deferred(id);
611
612
  evalState.pending.set(deferred.id, deferred);
@@ -689,7 +690,7 @@
689
690
  EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
690
691
  EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
691
692
  EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
692
- EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
693
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
693
694
  EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
694
695
  if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
695
696
  i.checked = false;
@@ -777,7 +778,7 @@
777
778
  }
778
779
  const snippetSrc = getFunctionBody(snippet);
779
780
  enableLogs && console.log("async eval:", snippetId, snippetSrc);
780
- return requestEval(snippetSrc).catch((e) => {
781
+ return requestEval(snippetSrc, snippetId).catch((e) => {
781
782
  enableLogs && console.error("error evaluating rule", snippetId, e);
782
783
  return false;
783
784
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Autoconsent",
4
- "version": "2023.12.27",
4
+ "version": "2023.12.28",
5
5
  "background": {
6
6
  "service_worker": "background.bundle.js"
7
7
  },
@@ -623,12 +623,13 @@ var evalState = {
623
623
  pending: /* @__PURE__ */ new Map(),
624
624
  sendContentMessage: null
625
625
  };
626
- function requestEval(code) {
626
+ function requestEval(code, snippetId) {
627
627
  const id = getRandomID();
628
628
  evalState.sendContentMessage({
629
629
  type: "eval",
630
630
  id,
631
- code
631
+ code,
632
+ snippetId
632
633
  });
633
634
  const deferred = new Deferred(id);
634
635
  evalState.pending.set(deferred.id, deferred);
@@ -712,7 +713,7 @@ var snippets = {
712
713
  EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
713
714
  EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
714
715
  EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
715
- EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
716
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
716
717
  EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
717
718
  if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
718
719
  i.checked = false;
@@ -800,7 +801,7 @@ var AutoConsentCMPBase = class {
800
801
  }
801
802
  const snippetSrc = getFunctionBody(snippet);
802
803
  enableLogs && console.log("async eval:", snippetId, snippetSrc);
803
- return requestEval(snippetSrc).catch((e) => {
804
+ return requestEval(snippetSrc, snippetId).catch((e) => {
804
805
  enableLogs && console.error("error evaluating rule", snippetId, e);
805
806
  return false;
806
807
  });
@@ -598,12 +598,13 @@ var evalState = {
598
598
  pending: /* @__PURE__ */ new Map(),
599
599
  sendContentMessage: null
600
600
  };
601
- function requestEval(code) {
601
+ function requestEval(code, snippetId) {
602
602
  const id = getRandomID();
603
603
  evalState.sendContentMessage({
604
604
  type: "eval",
605
605
  id,
606
- code
606
+ code,
607
+ snippetId
607
608
  });
608
609
  const deferred = new Deferred(id);
609
610
  evalState.pending.set(deferred.id, deferred);
@@ -687,7 +688,7 @@ var snippets = {
687
688
  EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
688
689
  EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
689
690
  EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
690
- EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
691
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC|GHCC"),
691
692
  EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
692
693
  if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
693
694
  i.checked = false;
@@ -775,7 +776,7 @@ var AutoConsentCMPBase = class {
775
776
  }
776
777
  const snippetSrc = getFunctionBody(snippet);
777
778
  enableLogs && console.log("async eval:", snippetId, snippetSrc);
778
- return requestEval(snippetSrc).catch((e) => {
779
+ return requestEval(snippetSrc, snippetId).catch((e) => {
779
780
  enableLogs && console.error("error evaluating rule", snippetId, e);
780
781
  return false;
781
782
  });