@duckduckgo/autoconsent 17.4.0 → 18.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/.prettierignore +1 -0
- package/AGENTS.md +2 -0
- package/CHANGELOG.md +34 -0
- package/dist/addon-firefox/background.bundle.js +2 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +602 -53
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rule-index.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/background.bundle.js +2 -0
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +602 -53
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rule-index.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +608 -59
- package/dist/autoconsent.esm.js +608 -59
- package/dist/autoconsent.playwright.js +602 -53
- package/dist/autoconsent.standalone.js +609 -60
- package/dist/heuristics.cjs.js +621 -52
- package/dist/heuristics.mjs +609 -50
- package/dist/types/eval-snippets.d.ts +1 -0
- package/dist/types/heuristic-classify.d.ts +2 -6
- package/dist/types/heuristic-detect.d.ts +32 -0
- package/dist/types/heuristic-literals.d.ts +1 -0
- package/dist/types/heuristic-negatives.d.ts +25 -0
- package/dist/types/heuristic-patterns.d.ts +18 -2
- package/dist/types/heuristic-prefilter.d.ts +13 -0
- package/docs/heuristic-detection.md +78 -0
- package/docs/heuristic-prefilter.md +62 -0
- package/eslint.config.mjs +16 -1
- package/lib/eval-snippets.ts +2 -0
- package/lib/heuristic-classify.ts +4 -39
- package/lib/heuristic-detect.ts +209 -0
- package/lib/heuristic-literals.ts +207 -0
- package/lib/heuristic-negatives.ts +173 -0
- package/lib/heuristic-patterns.ts +104 -31
- package/lib/heuristic-prefilter.ts +40 -0
- package/lib/heuristics.ts +8 -4
- package/lib/web.ts +1 -1
- package/package.json +2 -1
- package/rules/autoconsent/binogi.json +32 -0
- package/rules/autoconsent/bokio.json +32 -0
- package/rules/autoconsent/botble-cookie-consent.json +16 -0
- package/rules/autoconsent/calcolo-tools.json +23 -0
- package/rules/autoconsent/consilium-europa-eu.json +35 -0
- package/rules/autoconsent/dtu-findit.json +47 -0
- package/rules/autoconsent/hikvision.com.json +18 -0
- package/rules/autoconsent/hurra-consent.json +16 -0
- package/rules/autoconsent/isidewith.com.json +38 -0
- package/rules/autoconsent/landgate.json +10 -0
- package/rules/autoconsent/pakamera.json +19 -0
- package/rules/autoconsent/purecookie-cosmetic.json +13 -0
- package/rules/autoconsent/random-org.json +41 -0
- package/rules/autoconsent/tallink.json +13 -0
- package/rules/autoconsent/tealium.json +4 -1
- package/rules/autoconsent/typo3-cookieconsent.json +9 -0
- package/rules/autoconsent/vinnies-org-au.json +29 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/scripts/build-heuristic-literals.ts +24 -0
- package/scripts/required-literals.ts +177 -0
- package/tests/binogi.spec.ts +3 -0
- package/tests/bokio.spec.ts +6 -0
- package/tests/botble-cookie-consent.spec.ts +11 -0
- package/tests/calcolo-tools.spec.ts +3 -0
- package/tests/consilium-europa-eu.spec.ts +3 -0
- package/tests/dtu-findit.spec.ts +3 -0
- package/tests/hikvision.com.spec.ts +3 -0
- package/tests/hurra-consent.spec.ts +8 -0
- package/tests/isidewith.com.spec.ts +3 -0
- package/tests/landgate.spec.ts +3 -0
- package/tests/pakamera.spec.ts +5 -0
- package/tests/purecookie-cosmetic.spec.ts +8 -0
- package/tests/random-org.spec.ts +3 -0
- package/tests/tallink.spec.ts +3 -0
- package/tests/typo3-cookieconsent.spec.ts +10 -0
- package/tests/vinnies-org-au.spec.ts +3 -0
- package/tests-wtr/heuristics/heuristics-utils.test.ts +222 -8
- package/tests-wtr/heuristics/regex-syntax.test.ts +81 -0
- package/rules/generated/auto_NL_bonprix.nl_ovi.json +0 -40
- package/tests/generated/auto_NL_bonprix.nl_ovi.spec.ts +0 -2
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// Generated by `npm run build-heuristic-literals` from DETECT_PATTERNS. Do not edit.
|
|
2
|
+
// Entry i holds the literals DETECT_PATTERNS[i] needs to match (see docs/heuristic-prefilter.md).
|
|
3
|
+
export const DETECT_PATTERN_LITERALS: string[][] = [
|
|
4
|
+
["accept cookies"],
|
|
5
|
+
["accept all"],
|
|
6
|
+
["reject all"],
|
|
7
|
+
["only necessary cookies"],
|
|
8
|
+
[],
|
|
9
|
+
[],
|
|
10
|
+
[" cookies"],
|
|
11
|
+
["we are using cookies"],
|
|
12
|
+
["use of cookies"],
|
|
13
|
+
["website uses cookies to enhance your browsing experience"],
|
|
14
|
+
["cookies"],
|
|
15
|
+
[" technologies"],
|
|
16
|
+
["such as cookies"],
|
|
17
|
+
["read more about"],
|
|
18
|
+
["consent to"],
|
|
19
|
+
["we and our partners"],
|
|
20
|
+
["information"],
|
|
21
|
+
["store and/or access information"],
|
|
22
|
+
["personalised ads and content, ad and content measurement"],
|
|
23
|
+
[" and/or access"],
|
|
24
|
+
["and our partners ask for your consent"],
|
|
25
|
+
["we and "],
|
|
26
|
+
["partners","partnern","partner","partenaires","socios","vendors","fornitori"],
|
|
27
|
+
["partner"],
|
|
28
|
+
["technolog"],
|
|
29
|
+
["cookies"],
|
|
30
|
+
["cookies"],
|
|
31
|
+
["optional","additional","non-essential"],
|
|
32
|
+
["storing of cookies","placed cookies"],
|
|
33
|
+
[" on your device","access and store "],
|
|
34
|
+
["we use "],
|
|
35
|
+
["out of "],
|
|
36
|
+
["out of the sale"],
|
|
37
|
+
["this website or its third"],
|
|
38
|
+
["information"],
|
|
39
|
+
["rights with regard to the sale"],
|
|
40
|
+
["we use technologies "],
|
|
41
|
+
["continue reading with advertising"," tracking"],
|
|
42
|
+
["consent and continue"],
|
|
43
|
+
["store or retrieve information on your browser","stockées dans votre navigateur ou récupérées"],
|
|
44
|
+
["utilisons"],
|
|
45
|
+
["cookies"],
|
|
46
|
+
["consentement"],
|
|
47
|
+
["partenaires"],
|
|
48
|
+
["publicités"],
|
|
49
|
+
["utilise"],
|
|
50
|
+
["utilisent"],
|
|
51
|
+
["stocker"],
|
|
52
|
+
["consentement"],
|
|
53
|
+
["consentement"],
|
|
54
|
+
["accepter"],
|
|
55
|
+
["utilisation"],
|
|
56
|
+
["technologies"],
|
|
57
|
+
["utilisation"],
|
|
58
|
+
["continuer sans accepter"],
|
|
59
|
+
["tout refuser"],
|
|
60
|
+
[" tous les cookies"],
|
|
61
|
+
["je refuse"],
|
|
62
|
+
["refuser et continuer"],
|
|
63
|
+
["refuser les cookies"],
|
|
64
|
+
["seulement nécessaires"],
|
|
65
|
+
["je désactive les finalités non essentielles"],
|
|
66
|
+
["cookies essentiels uniquement"],
|
|
67
|
+
["nécessaires uniquement"],
|
|
68
|
+
["stocker","stockons"],
|
|
69
|
+
["nos partenaires demandent votre consentement"],
|
|
70
|
+
["consentez à l"," cookies"],
|
|
71
|
+
["les cookies nous permettent","nos partenaires et nous"],
|
|
72
|
+
["accepter "],
|
|
73
|
+
["verwenden"],
|
|
74
|
+
["partner"],
|
|
75
|
+
["zugriff auf informationen auf"],
|
|
76
|
+
["werbeleistung"],
|
|
77
|
+
["cookies"],
|
|
78
|
+
["verwendung"],
|
|
79
|
+
["cookies"],
|
|
80
|
+
["verwendet"],
|
|
81
|
+
["auswahl"],
|
|
82
|
+
["technologien"],
|
|
83
|
+
["verwenden"],
|
|
84
|
+
["ablehnen"],
|
|
85
|
+
["zusätzliche","essenzielle","funktionale","notwendige","erforderliche"],
|
|
86
|
+
["einwilligung","zustimmung","cookies"],
|
|
87
|
+
["ablehnen"],
|
|
88
|
+
["nur funktionale cookies akzeptieren"],
|
|
89
|
+
["optionale ablehnen"],
|
|
90
|
+
["zustimmung verweigern"],
|
|
91
|
+
["speichern und/oder "],
|
|
92
|
+
["unsere partner bitten um ihre zustimmung"],
|
|
93
|
+
[" cookies"],
|
|
94
|
+
["cookies "],
|
|
95
|
+
[" zum einsatz","einsatz von cookies"],
|
|
96
|
+
["einverstanden","einverstanden"],
|
|
97
|
+
["akzeptieren","zulassen","erlauben","zustimmen"],
|
|
98
|
+
["zustimmen und weiter"," ohne zu "],
|
|
99
|
+
["einwilligung","zustimmung","zustimmung","einwilligung"],
|
|
100
|
+
["tracking-technologien"],
|
|
101
|
+
["verwendung "],
|
|
102
|
+
["mit werbetracking weiterlesen","weiter mit werbung","con tracking e annunci"],
|
|
103
|
+
["gebruik"],
|
|
104
|
+
["gebruiken"],
|
|
105
|
+
["vergelijkbare"],
|
|
106
|
+
["afwijzen","weigeren","verwerpen"],
|
|
107
|
+
["noodzakelijk"],
|
|
108
|
+
["cookies weigeren"],
|
|
109
|
+
["weiger"],
|
|
110
|
+
["doorgaan zonder "],
|
|
111
|
+
["optionele","functionele","functioneel","noodzakelijke","essentiële"],
|
|
112
|
+
["wijs alles af"],
|
|
113
|
+
[],
|
|
114
|
+
["onze partners vragen om "],
|
|
115
|
+
["wij en onze "],
|
|
116
|
+
[" cookies"],
|
|
117
|
+
["accepteer "],
|
|
118
|
+
["analytische","functionele","essentiële","noodzakelijke"],
|
|
119
|
+
[" contin"],
|
|
120
|
+
["cookie"],
|
|
121
|
+
[" uso de cookies"],
|
|
122
|
+
["usa cookies de google"],
|
|
123
|
+
[" uso de cookies"],
|
|
124
|
+
["al utilizar nuestro sitio web"],
|
|
125
|
+
["almacenar la información en un dispositivo y"],
|
|
126
|
+
[" utiliza"],
|
|
127
|
+
["cookies propias y de"],
|
|
128
|
+
["son necesarias"],
|
|
129
|
+
[" cookie"],
|
|
130
|
+
["navegando"],
|
|
131
|
+
["nosotros y nuestros"],
|
|
132
|
+
["recopilamos y almacenamos datos de usted y de su dispositivo"],
|
|
133
|
+
["utilizamos tecnolog"],
|
|
134
|
+
["almacenar","almacenamos"],
|
|
135
|
+
["nuestros socios solicitan su consentimiento"],
|
|
136
|
+
["tanto nosotros como","nosotros y"],
|
|
137
|
+
["aceptar","rechazar","continuar sin aceptar","solo las necesarias"],
|
|
138
|
+
["uso de "],
|
|
139
|
+
["cookies "],
|
|
140
|
+
["las cookies nos "],
|
|
141
|
+
["instalamos","empleamos"],
|
|
142
|
+
["cookies","necesitamos usar cookies"],
|
|
143
|
+
[" cookie"],
|
|
144
|
+
["używać","używamy"],
|
|
145
|
+
["cele przetwarzania twoich danych przez zaufanych partnerów iab"],
|
|
146
|
+
["dzięki "],
|
|
147
|
+
[" plików cookie"],
|
|
148
|
+
["korzystamy z technologii, takich jak pliki cookie"],
|
|
149
|
+
["korzystamy"],
|
|
150
|
+
["niektóre pliki cookies"],
|
|
151
|
+
["pliki cookies i pokrewne im technologie umożliwiają poprawne działanie strony i pomagają nam dostosować ofertę do twoich potrzeb"],
|
|
152
|
+
["przechowywanie informacji na urządzeniu lub dostęp do nich"],
|
|
153
|
+
["przechowywanie plików cookie na swoim urządzeniu"],
|
|
154
|
+
["przechowywać i uzyskiwać dostęp do informacji na twoich urządzeniach"],
|
|
155
|
+
["przetwarzamy"],
|
|
156
|
+
[" używa "],
|
|
157
|
+
["ta strona korzysta z ciasteczek"],
|
|
158
|
+
["uzyskujemy dostęp i przechowujemy informacje na urządzeniu"],
|
|
159
|
+
["używa plik"],
|
|
160
|
+
["używamy plików"],
|
|
161
|
+
["wykorzystują "],
|
|
162
|
+
["za pomocą plików cookies"],
|
|
163
|
+
["zgodą my i nasi partnerzy możemy wykorzystywać precyzyjne dane geolokalizacyjne i identyfikację"],
|
|
164
|
+
["cookies pròpies i de tercers"],
|
|
165
|
+
["utilitzem galetes"],
|
|
166
|
+
["únicament utilitza galetes pròpies amb finalitat tècnica"],
|
|
167
|
+
["este lloc web utilitza només cookies tècniques necessàries per al seu funcionament"],
|
|
168
|
+
["de personalització i anàlisi"],
|
|
169
|
+
["utilitzem cookies i altres tecnologies"],
|
|
170
|
+
["cookies","galetes"],
|
|
171
|
+
["cookie propio eta hirugarrenenak helburu teknikoarekin erabiltzen ditu"],
|
|
172
|
+
["cookie propioak eta hirugarrenen cookieak erabiltzen ditugu"],
|
|
173
|
+
["cookie propioak eta hirugarrenenak helburu teknikoarekin erabiltzen ditu"],
|
|
174
|
+
["ak erabiltzen ditu"],
|
|
175
|
+
["cookieak erabiltzen ditu"],
|
|
176
|
+
[" bazkideek cookieak eta identifikadoreak erabiltzen ditugu"],
|
|
177
|
+
["norberaren eta hirugarrenen cookie"],
|
|
178
|
+
["web orri honek cookieak erabiltzen ditu"],
|
|
179
|
+
["webgune honek cookie propioak eta hirugarrenen cookie-fitxategiak erabiltzen ditu"],
|
|
180
|
+
["empregamos cookies propias"],
|
|
181
|
+
["este portal emprega cookies propias ou de terceiros con fins analíticos"],
|
|
182
|
+
["использу"],
|
|
183
|
+
["использу"],
|
|
184
|
+
["cookie","куки"],
|
|
185
|
+
["технологи"],
|
|
186
|
+
["cookie","куки"],
|
|
187
|
+
[],
|
|
188
|
+
["usiamo","utilizziamo"],
|
|
189
|
+
["cookie"],
|
|
190
|
+
["noi e i nostri"],
|
|
191
|
+
[" cookie"],
|
|
192
|
+
[" cookie"],
|
|
193
|
+
["tecnici","di profilazione","di terze parti","analitici","statistici","di marketing"],
|
|
194
|
+
["acconsent","accett"],
|
|
195
|
+
[" navigazione"],
|
|
196
|
+
["accetta","accetto","accettare","rifiuta","rifiuto","rifiutare"],
|
|
197
|
+
[" senza accettare"],
|
|
198
|
+
["rifiuta e abbonati"],
|
|
199
|
+
["consenso "],
|
|
200
|
+
[" nostri "],
|
|
201
|
+
["terze parti selezionate"],
|
|
202
|
+
["archiviare","archiviamo","memorizzare","memorizziamo"],
|
|
203
|
+
["använder"],
|
|
204
|
+
["cookie","クッキー"],
|
|
205
|
+
["bruger cookies"],
|
|
206
|
+
["informasjonskapsler","cookies"],
|
|
207
|
+
];
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context negatives for heuristic detect patterns: wording that shows a match, or a whole popup, isn't a consent notice.
|
|
3
|
+
* The vocabulary they test (consent choices, age wording, leave buttons, legal clauses) is defined here, next to them.
|
|
4
|
+
* See docs/heuristic-detection.md.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
HeuristicInput,
|
|
8
|
+
ACCEPTEZ_UTILISATION,
|
|
9
|
+
ACCEPT_ALL,
|
|
10
|
+
BY_CONTINUING_PRIVACY,
|
|
11
|
+
DE_COOKIE_VERB,
|
|
12
|
+
GEBRUIK_VAN_COOKIES,
|
|
13
|
+
USE_OF_COOKIES,
|
|
14
|
+
UTILISATION_DES_COOKIES,
|
|
15
|
+
VERWENDUNG_VON_COOKIES,
|
|
16
|
+
} from './heuristic-patterns';
|
|
17
|
+
|
|
18
|
+
/** A test on a text: a regex that must match it, or a predicate. */
|
|
19
|
+
export type TextTest = RegExp | ((text: string) => boolean);
|
|
20
|
+
/**
|
|
21
|
+
* Drops a single detect pattern match when its context matches `pattern` and not `unless` (with only `unless`, when the
|
|
22
|
+
* context lacks it). The context is `window` chars either side of the match, or its line and `lines` lines either side
|
|
23
|
+
* ([before, after] counts each side); the default is 150 chars. With `whole`, the context is the whole text, so a hit
|
|
24
|
+
* drops every match: the text is excluded. `appliesTo` limits it to some detect patterns.
|
|
25
|
+
*/
|
|
26
|
+
export type ContextNegative = {
|
|
27
|
+
name: string;
|
|
28
|
+
pattern?: RegExp;
|
|
29
|
+
unless?: TextTest;
|
|
30
|
+
window?: number;
|
|
31
|
+
lines?: number | [number, number];
|
|
32
|
+
whole?: boolean;
|
|
33
|
+
input?: HeuristicInput;
|
|
34
|
+
appliesTo?: RegExp[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// a cookie choice or dismiss control, or consent dialog wording, in the core languages, except a bare accept
|
|
38
|
+
const COOKIE_CHOICE = [
|
|
39
|
+
'\\b(?:accept|reject|decline|refuse|deny|allow|manage|customi[sz]e)\\b[^\\n]{0,25}\\bcookies?\\b',
|
|
40
|
+
'\\b(?:reject|decline|deny|refuse) all\\b',
|
|
41
|
+
'\\b(?:essential|necessary|required) (?:cookies )?only\\b|\\bonly (?:essential|necessary|required)\\b',
|
|
42
|
+
'\\bcookies? (?:notice|settings|preferences|banner)\\b',
|
|
43
|
+
'\\b(?:alle )?(?:cookies )?ablehnen\\b',
|
|
44
|
+
'\\b(?:alles |alle cookies )?(?:weigeren|weiger|afwijzen)\\b',
|
|
45
|
+
'\\b(?:tout )?refuser\\b',
|
|
46
|
+
'\\brechazar(?: todas?)?\\b',
|
|
47
|
+
'\\brifiuta(?: tutti)?\\b',
|
|
48
|
+
// purposes and vendors as a button or heading line: some consent dialogs ask "under 18?"
|
|
49
|
+
'^[^\\n]{0,40}\\b(?:purposes|finalités|propósitos|zwecke|doeleinden|finalità|vendors|fournisseurs|proveedores|leveranciers|fornitori)(?!\\w)[^\\n]{0,10}$',
|
|
50
|
+
'\\b(?:legitimate (?:business )?interest|intérêt légitime|interés legítimo|berechtigtes interesse|gerechtvaardigd belang|legittimo interesse)\\b',
|
|
51
|
+
'\\b(?:we|nous|wir|wij|noi|nosotros) (?:and|et|und|en|e|y) (?:our|nos|unsere|onze|i nostri|nuestros) (?:\\d+ )?(?:partners|partenaires|partner|socios)\\b',
|
|
52
|
+
].join('|');
|
|
53
|
+
// a bare accept or allow (all), which can also be an age gate's own confirmation
|
|
54
|
+
const BARE_ACCEPT = [
|
|
55
|
+
'\\b(?:accept|allow) all\\b',
|
|
56
|
+
'\\b(?:alle )?(?:cookies )?(?:akzeptieren|erlauben|zulassen)\\b',
|
|
57
|
+
'\\b(?:alles |alle cookies )?(?:accepteren|accepteer|toestaan)\\b',
|
|
58
|
+
'\\b(?:tout )?accepter\\b',
|
|
59
|
+
'\\baceptar(?: todas?)?\\b',
|
|
60
|
+
'\\baccetta(?: tutti)?\\b',
|
|
61
|
+
].join('|');
|
|
62
|
+
const COOKIE_CHOICE_RE = new RegExp(COOKIE_CHOICE, 'im');
|
|
63
|
+
const CONSENT_CHOICE = new RegExp(`${COOKIE_CHOICE}|${BARE_ACCEPT}`, 'im');
|
|
64
|
+
|
|
65
|
+
// an age limit, an adults-only statement or an age check, in the core languages
|
|
66
|
+
const AGE_WORDING = new RegExp(
|
|
67
|
+
[
|
|
68
|
+
'\\b(?:over|above|at least|older than|minimum(?: age of)?)\\s*(?:18|21|eighteen)\\b',
|
|
69
|
+
// "18+" only with age words after it: a bare "18+" also appears in cookie banners on adult sites
|
|
70
|
+
'\\b(?:18|21)\\+?\\s*(?:years?(?: of age| old)?|yo|or older|or over)\\b',
|
|
71
|
+
'\\b(?:you|users?|visitors?) must be (?:over |above |at least )?(?:18|21)\\b',
|
|
72
|
+
"\\b(?:i'?m|i am) (?:over |at least )?(?:18|21)\\b",
|
|
73
|
+
'\\bage (?:verification|confirmation|check|gate|restriction)\\b',
|
|
74
|
+
'\\b(?:adults? only|adult[\\s-](?:oriented|content|material|website)|legal age|age of majority|not a minor|minors)\\b',
|
|
75
|
+
'\\b(?:18|21) jahre\\b',
|
|
76
|
+
'\\balters(?:beschränkung|bestätigung|verifikation|prüfung|kontrolle)',
|
|
77
|
+
'\\b(?:volljährig|für erwachsene|minderjährige)\\b',
|
|
78
|
+
'\\b(?:18|21) jaar\\b',
|
|
79
|
+
'\\b(?:volwassenen|meerderjarig|minderjarigen|leeftijdsverificatie)\\b',
|
|
80
|
+
'\\b(?:18|21) ans\\b',
|
|
81
|
+
// no \\b before an accented letter: without the u flag it is not a word character
|
|
82
|
+
'\\b(?:pour adultes|vérification de l.âge|mineurs)\\b|âge légal\\b',
|
|
83
|
+
'\\b(?:18|21) años\\b',
|
|
84
|
+
'\\b(?:mayor(?:es)? de edad|menores de edad|para adultos|verificación de edad)\\b',
|
|
85
|
+
'\\b(?:18|21) anni\\b',
|
|
86
|
+
'\\b(?:maggiorenne|minorenni|per adulti)\\b|\\bverifica dell.età(?!\\w)',
|
|
87
|
+
].join('|'),
|
|
88
|
+
'i',
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
// a dismiss or consent button on its own line, as innerText keeps it
|
|
92
|
+
const DISMISS_LINE =
|
|
93
|
+
/^\s*(?:(?:yes,? )?(?:i )?(?:ok(?:ay)?|accept|agree|allow|decline|deny|reject|refuse|understand|acknowledge(?: the use of cookies)?|got it|understood)(?: all)?(?:,? (?:and|&) (?:continue|close))?(?: non-essential)?|close|dismiss|akzeptieren|zustimmen|verstanden|einverstanden|ablehnen|accepteren|akkoord|weigeren|accepter|j.accepte|d.accord|refuser|fermer|aceptar|acepto|rechazar|entendido|accetto|accetta|rifiuta|ho capito|chiudi)\s*[!.]?\s*$/im;
|
|
94
|
+
// a dismiss button at the end of a notice's line, or a close control
|
|
95
|
+
const DISMISS_END = /[.!?]\s+(?:ok(?:ay)?|got it|i agree|accept)\s*!?\s*$|\[\s*[x×]\s*\]|^\s*[x×✕]\s*$/im;
|
|
96
|
+
const NOTICE_CONTROL = new RegExp(`${CONSENT_CHOICE.source}|${DISMISS_LINE.source}|${DISMISS_END.source}`, 'im');
|
|
97
|
+
// an age gate's leave button on its own line, or "I am under 18" in the core languages
|
|
98
|
+
const LEAVE_LINE =
|
|
99
|
+
/^\s*(?:(?:no,? )?(?:i )?(?:want to )?(?:leave|exit|verlassen|quitter|sortir|salir|abandonar|esci|uscire|verlaten)\b[^\n]{0,30}|no,? take me away|(?:seite|hier) verlassen|(?:i am|i'm|ich bin|ik ben|je suis|soy|sono) (?:under|unter|onder|jonger dan|menor de(?: edad)?|minorenne|mineur)\b[^\n]{0,10})\s*[!.]?\s*$/im;
|
|
100
|
+
// a notice's own control: manage or configure cookies, a bare settings button line, or "close this popup"
|
|
101
|
+
const NOTICE_OWN_CONTROL = new RegExp(
|
|
102
|
+
[
|
|
103
|
+
'\\bcookies? verwalten\\b|\\bcookie-?(?:einstellungen|präferenzen)\\b|\\beinstellungen verwalten\\b',
|
|
104
|
+
'\\bconfigura(?:r|ción de)(?: las)? cookies\\b|\\bgestionar(?: las)? cookies\\b|\\bpersonalizar(?: las)? cookies\\b',
|
|
105
|
+
'\\bparam[ée]trer(?: les)? cookies\\b|\\bparam[èe]tres(?: des)? cookies\\b|\\bg[ée]rer(?: les)? cookies\\b|\\bpersonnaliser(?: les)? cookies\\b',
|
|
106
|
+
'\\bgestisci(?: i)? cookie|\\bimpostazioni(?: dei| sui)? cookie|\\bpersonalizza(?: i)? cookie',
|
|
107
|
+
'\\bcookie-?instellingen\\b|\\bcookies? beheren\\b|\\bvoorkeuren (?:beheren|aanpassen)\\b',
|
|
108
|
+
'^\\s*(?:customi[sz]e|personnaliser|paramétrer|personalizar|configurar|personalizza|anpassen|aanpassen|meer opties|more options|weitere optionen|plus d.options|más opciones|altre opzioni|manage (?:options|preferences|choices))\\s*$',
|
|
109
|
+
'^\\s*close (?:this|the) (?:popup|banner|notice|message)\\s*$',
|
|
110
|
+
].join('|'),
|
|
111
|
+
'im',
|
|
112
|
+
);
|
|
113
|
+
// the age-gate exclusions' unless: a consent or notice control, and no leave button. An age gate's "OK" next to "Leave"
|
|
114
|
+
// confirms the age, not cookies.
|
|
115
|
+
const ageGateUnless =
|
|
116
|
+
(control: RegExp) =>
|
|
117
|
+
(text: string): boolean =>
|
|
118
|
+
!LEAVE_LINE.test(text) && (control.test(text) || NOTICE_OWN_CONTROL.test(text));
|
|
119
|
+
// consent vocabulary beyond "privacy", for patterns that also match terms of use and login text
|
|
120
|
+
const CONSENT_WORDS =
|
|
121
|
+
/cookie|consent|track|partner|personali[sz]|advertis|analytic|privacy (?:options|choices|settings|rights)|do not sell|opt[- ]out/i;
|
|
122
|
+
|
|
123
|
+
// license and terms clauses that cookie notices never contain, so a popup with them is a legal agreement
|
|
124
|
+
const LEGAL_AGREEMENT =
|
|
125
|
+
/\b(?:end[- ]user licen[cs]e agreement|licen[cs]e agreement|limitation of liability|governing law|indemnif\w*|hereunder|disclaimers? of warrant\w*|warrant(?:y|ies) of merchantability)\b/i;
|
|
126
|
+
|
|
127
|
+
// drop single matches whose context shows the text isn't a consent notice, or whole popups that aren't one
|
|
128
|
+
export const DETECT_CONTEXT_NEGATIVES: ContextNegative[] = [
|
|
129
|
+
// popups with their own age confirmation are age gates, even when they mention cookies; a bare accept doesn't count
|
|
130
|
+
// as a cookie choice here, since it may confirm the age
|
|
131
|
+
{ name: 'age-gate-popup', pattern: AGE_WORDING, unless: ageGateUnless(COOKIE_CHOICE_RE), whole: true, input: 'popup' },
|
|
132
|
+
// a license or terms agreement may mention cookies, and its decline button must not be clicked as a cookie reject
|
|
133
|
+
{ name: 'legal-agreement', pattern: LEGAL_AGREEMENT, whole: true, input: 'popup' },
|
|
134
|
+
// page text next to an age gate, unless a consent control is there too
|
|
135
|
+
{ name: 'age-gate', pattern: AGE_WORDING, unless: ageGateUnless(NOTICE_CONTROL), lines: [4, 5], input: 'page' },
|
|
136
|
+
// terms of use need cookie or consent wording; a privacy-policy-only notice needs that or a button
|
|
137
|
+
{
|
|
138
|
+
name: 'terms-without-consent',
|
|
139
|
+
pattern: /\bterms\b|\bconditions\b/i,
|
|
140
|
+
unless: CONSENT_WORDS,
|
|
141
|
+
appliesTo: [BY_CONTINUING_PRIVACY],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'privacy-without-control',
|
|
145
|
+
unless: new RegExp(`${CONSENT_WORDS.source}|${DISMISS_LINE.source}`, 'im'),
|
|
146
|
+
appliesTo: [BY_CONTINUING_PRIVACY],
|
|
147
|
+
},
|
|
148
|
+
// a cookie policy link among short footer link lines
|
|
149
|
+
{
|
|
150
|
+
name: 'footer-link',
|
|
151
|
+
pattern: /^[^.!?:\n]{0,60}\n[\s]*\n?[^.!?:\s][^.!?:\n]{0,59}(?:\n|$)/,
|
|
152
|
+
unless: NOTICE_CONTROL,
|
|
153
|
+
lines: [0, 2],
|
|
154
|
+
input: 'page',
|
|
155
|
+
appliesTo: [USE_OF_COOKIES, VERWENDUNG_VON_COOKIES, UTILISATION_DES_COOKIES, GEBRUIK_VAN_COOKIES],
|
|
156
|
+
},
|
|
157
|
+
// "accept all" in prose; case-sensitive since button labels run together in innerText
|
|
158
|
+
{
|
|
159
|
+
name: 'accept-all-prose',
|
|
160
|
+
pattern: /\baccept all [a-z]|\baccept All[a-z]/,
|
|
161
|
+
unless: /accept all (?:cookies|and|&)/i,
|
|
162
|
+
window: 15,
|
|
163
|
+
appliesTo: [ACCEPT_ALL],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'acceptez-terms',
|
|
167
|
+
pattern: /conditions (?:générales )?d.utilisation|\bcgu\b/i,
|
|
168
|
+
unless: /cookie|témoin|traceur|partenaire/i,
|
|
169
|
+
appliesTo: [ACCEPTEZ_UTILISATION],
|
|
170
|
+
},
|
|
171
|
+
// the same sentence is also a footer line with only a "learn more" link
|
|
172
|
+
{ name: 'de-cookie-verb-needs-control', unless: NOTICE_CONTROL, lines: [1, 6], input: 'page', appliesTo: [DE_COOKIE_VERB] },
|
|
173
|
+
];
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
/** Which text a detect pattern or context negative applies to: a popup element's text, or a whole page's text. */
|
|
2
|
+
export type HeuristicInput = 'popup' | 'page';
|
|
3
|
+
/** A detect pattern, optionally limited to one input. */
|
|
4
|
+
export type DetectPattern = RegExp | { pattern: RegExp; input: HeuristicInput };
|
|
5
|
+
/** A detect pattern's regex. */
|
|
6
|
+
export const patternOf = (p: DetectPattern): RegExp => (p instanceof RegExp ? p : p.pattern);
|
|
7
|
+
// detect patterns that context negatives refer to
|
|
8
|
+
export const BY_CONTINUING_PRIVACY = /(?:by continuing.{0,100}privacy)|(?:privacy.{0,100}by continuing)/gi;
|
|
9
|
+
export const ACCEPT_ALL = /accept all/gi;
|
|
10
|
+
export const USE_OF_COOKIES = /use of cookies/gi;
|
|
11
|
+
export const UTILISATION_DES_COOKIES = /utilisation.{0,100}des.{0,100}cookies/gi;
|
|
12
|
+
export const ACCEPTEZ_UTILISATION = /acceptez.{0,100}l.{0,100}utilisation/gi;
|
|
13
|
+
export const VERWENDUNG_VON_COOKIES = /verwendung.{0,100}von.{0,100}cookies/gi;
|
|
14
|
+
export const DE_COOKIE_VERB =
|
|
15
|
+
/\b(?:nutzen|nutzt|verwenden|verwendet|setzen|setzt|benutzen|benutzt|speichert|platzieren)\b(?: \S+){0,4} cookies\b/gi;
|
|
16
|
+
export const GEBRUIK_VAN_COOKIES = /gebruik.{0,100}van.{0,100}cookies/gi;
|
|
17
|
+
|
|
1
18
|
// TODO: check for false positive detections per pattern
|
|
2
19
|
// these patterns are matched against popup-like elements or full document text to detect unknown cookie popups
|
|
3
|
-
export const DETECT_PATTERNS = [
|
|
20
|
+
export const DETECT_PATTERNS: DetectPattern[] = [
|
|
4
21
|
/accept cookies/gi,
|
|
5
|
-
|
|
22
|
+
ACCEPT_ALL,
|
|
6
23
|
/reject all/gi,
|
|
7
24
|
/only necessary cookies/gi, // "only necessary" is probably too broad
|
|
8
25
|
/(?:by continuing.{0,100}cookie)|(?:cookie.{0,100}by continuing)/gi,
|
|
9
|
-
|
|
26
|
+
BY_CONTINUING_PRIVACY,
|
|
10
27
|
// up to two qualifiers are common: "optional", "essential", "analytics", "google analytics", "third party", ...
|
|
11
28
|
/we (?:use|serve)(?: \w+){0,2} cookies/gi,
|
|
12
29
|
/we are using cookies/gi,
|
|
13
|
-
|
|
30
|
+
USE_OF_COOKIES,
|
|
14
31
|
/website uses cookies to enhance your browsing experience/gi,
|
|
15
32
|
/(?:this|our) (?:web)?site.{0,100}cookies/gi,
|
|
16
33
|
/cookies (?:and|or) .{0,100} technologies/gi,
|
|
@@ -21,6 +38,33 @@ export const DETECT_PATTERNS = [
|
|
|
21
38
|
/we.{0,100}store.{0,100}information.{0,100}such as.{0,100}cookies/gi,
|
|
22
39
|
/store and\/or access information.{0,100}on a device/gi,
|
|
23
40
|
/personalised ads and content, ad and content measurement/gi,
|
|
41
|
+
// TCF wording: "store and/or access information", "and our partners ask for your consent", "we and our N partners"
|
|
42
|
+
/\b(?:store|stores|storing) and\/or access(?:ing)? information\b/gi,
|
|
43
|
+
/\band our partners ask for your consent\b/gi,
|
|
44
|
+
/\bwe and (?:our|up to) (?:\d+ )?(?:partners|vendors)\b/gi,
|
|
45
|
+
// a partner count, in each language: "our 186 partners", "unseren 107 Partnern", "nuestros 1064 socios"
|
|
46
|
+
/\b(?:our|unseren|onze|nos|nuestros|i nostri) \d{2,4} (?:partners|partnern|partner|partenaires|socios|vendors|fornitori)\b/gi,
|
|
47
|
+
/\b\d{2,4} iab[- ]partner/gi,
|
|
48
|
+
// "technologies like cookies", in each language
|
|
49
|
+
/\btechnolog(?:ies|ien|ieën|ías|ie) (?:like|such as|wie|zoals|como(?: las)?|telles que(?: les)?|come(?: i)?) cookies?\b/gi,
|
|
50
|
+
/\buses (?:\S+ ){0,2}cookies\b/gi,
|
|
51
|
+
/\b(?:like|want) to (?:use|set) (?:\S+ ){0,2}cookies\b/gi,
|
|
52
|
+
/\b(?:optional|additional|non-essential) cookies\b/gi,
|
|
53
|
+
/\bstoring of cookies\b|\bplaced cookies\b/gi,
|
|
54
|
+
/\b(?:store|stores) and access (?:data|information) on your device\b|\baccess and store (?:data|information) on your device\b/gi,
|
|
55
|
+
/\bwe use (?:\S+ ){1,4}cookies\b/gi,
|
|
56
|
+
// US privacy notices: opt-out sentences, not the footer link labels
|
|
57
|
+
/\byou (?:can|may) opt[- ]out of (?:the |this )?(?:sale|sharing|use|selling)\b/gi,
|
|
58
|
+
/\b(?:if you wish to|to) opt[- ]out of the sale\b/gi,
|
|
59
|
+
/\bthis website or its third[- ]party tools (?:process|use)\b/gi,
|
|
60
|
+
/["“]?(?:share|sell)["”]? or ["“]?(?:sell|share)["”]? (?:your )?(?:personal )?information\b/gi,
|
|
61
|
+
/\bresidents have (?:certain )?rights with regard to the sale\b/gi,
|
|
62
|
+
/\bwe use technologies (?:on this website )?(?:that may )?(?:to )?collect\b/gi,
|
|
63
|
+
// pay-or-consent walls
|
|
64
|
+
/\bcontinue reading with advertising\b|\b(?:with|mit) (?:advertising|werbung) (?:and|und) tracking\b/gi,
|
|
65
|
+
/\bconsent and continue\b/gi,
|
|
66
|
+
// preference centres are often in the page but hidden, so popup text only
|
|
67
|
+
{ pattern: /\bstore or retrieve information on your browser\b|\bstockées dans votre navigateur ou récupérées\b/gi, input: 'popup' },
|
|
24
68
|
|
|
25
69
|
// it might be tempting to add the patterns below, but they cause too many false positives. Don't do it :)
|
|
26
70
|
// /cookies? settings/i,
|
|
@@ -38,27 +82,33 @@ export const DETECT_PATTERNS = [
|
|
|
38
82
|
/consentement.{0,100}à.{0,100}tout.{0,100}moment/gi,
|
|
39
83
|
/votre.{0,100}consentement/gi,
|
|
40
84
|
/accepter.{0,100}tout/gi,
|
|
41
|
-
|
|
85
|
+
UTILISATION_DES_COOKIES,
|
|
42
86
|
/cookies.{0,100}ou.{0,100}technologies/gi,
|
|
43
|
-
|
|
87
|
+
ACCEPTEZ_UTILISATION,
|
|
44
88
|
/continuer sans accepter/gi,
|
|
45
89
|
/tout refuser/gi,
|
|
46
90
|
/(?:refuser|rejeter) tous les cookies/gi,
|
|
47
|
-
|
|
91
|
+
// not "je refuse d'…" in a headline
|
|
92
|
+
/je refuse(?! d['’e])/gi,
|
|
48
93
|
/refuser et continuer/gi,
|
|
49
94
|
/refuser les cookies/gi,
|
|
50
95
|
/seulement nécessaires/gi,
|
|
51
96
|
/je désactive les finalités non essentielles/gi,
|
|
52
97
|
/cookies essentiels uniquement/gi,
|
|
53
98
|
/nécessaires uniquement/gi,
|
|
99
|
+
/\b(?:stocker|stockons) et\/ou (?:accéder|accédons)\b/gi,
|
|
100
|
+
/\bnos partenaires demandent votre consentement\b/gi,
|
|
101
|
+
/\bconsentez à l.utilisation (?:de |des )?cookies\b|\bdépôt (?:de|des) cookies\b/gi,
|
|
102
|
+
/\bles cookies nous permettent\b|\bnos partenaires et nous(?:-mêmes)?\b/gi,
|
|
103
|
+
/\baccepter (?:&|et) fermer\b/gi,
|
|
54
104
|
|
|
55
105
|
// DE
|
|
56
106
|
/wir.{0,100}verwenden.{0,100}cookies/gi,
|
|
57
107
|
/wir.{0,100}und.{0,100}unsere.{0,100}partner/gi,
|
|
58
|
-
/zugriff
|
|
108
|
+
/zugriff auf informationen auf/gi,
|
|
59
109
|
/inhalte.{0,100}messung.{0,100}von.{0,100}werbeleistung.{0,100}und/gi,
|
|
60
110
|
/cookies.{0,100}und.{0,100}andere/gi,
|
|
61
|
-
|
|
111
|
+
VERWENDUNG_VON_COOKIES,
|
|
62
112
|
/wir.{0,100}nutzen.{0,100}cookies/gi,
|
|
63
113
|
/verwendet.{0,100}cookies/gi,
|
|
64
114
|
/sie.{0,100}können.{0,100}ihre.{0,100}auswahl/gi,
|
|
@@ -72,9 +122,21 @@ export const DETECT_PATTERNS = [
|
|
|
72
122
|
/nur funktionale cookies akzeptieren/gi,
|
|
73
123
|
/optionale ablehnen/gi,
|
|
74
124
|
/zustimmung verweigern/gi,
|
|
125
|
+
/\bspeichern und\/oder (?:zugreifen|abrufen)\b/gi,
|
|
126
|
+
/\bunsere partner bitten um ihre zustimmung\b/gi,
|
|
127
|
+
DE_COOKIE_VERB,
|
|
128
|
+
/\b(?:werden|wird) (?:\S+ ){0,3}cookies (?:verwendet|eingesetzt|gesetzt|genutzt)\b/gi,
|
|
129
|
+
/\bcookies? zum einsatz\b|\beinsatz von cookies\b/gi,
|
|
130
|
+
/\beinverstanden\b.{0,60}\bcookies\b|\bcookies\b.{0,80}\beinverstanden\b/gi,
|
|
131
|
+
/\b(?:alle|alles) (?:cookies |optionalen \S+ )?(?:akzeptieren|zulassen|erlauben|zustimmen)\b/gi,
|
|
132
|
+
/\bzustimmen und weiter\b|\bweiter,? ohne zu (?:akzeptieren|zustimmen)\b/gi,
|
|
133
|
+
/\b(?:einwilligung|zustimmung) (?:zu|zur|in die) (?:\S+ )?cookies\b|\bcookie-(?:zustimmung|einwilligung)\b/gi,
|
|
134
|
+
/\btracking-technologien\b/gi,
|
|
135
|
+
/\bakzeptier\w* (?:du |sie )?(?:die )?verwendung (?:\S+ )?cookies\b/gi,
|
|
136
|
+
/\bmit werbetracking weiterlesen\b|\bweiter mit werbung\b|\bcon tracking e annunci\b/gi,
|
|
75
137
|
|
|
76
138
|
// NL
|
|
77
|
-
|
|
139
|
+
GEBRUIK_VAN_COOKIES,
|
|
78
140
|
/(?:we|wij).{0,100}gebruiken.{0,100}cookies.{0,100}om/gi,
|
|
79
141
|
/cookies.{0,100}en.{0,100}vergelijkbare/gi,
|
|
80
142
|
|
|
@@ -85,6 +147,13 @@ export const DETECT_PATTERNS = [
|
|
|
85
147
|
/doorgaan zonder (?:te accepteren|akkoord te gaan)/gi,
|
|
86
148
|
/alleen.{0,100}(?:optionele|functionele|functioneel|noodzakelijke|essentiële).{0,100}cookies/gi,
|
|
87
149
|
/wijs alles af/gi,
|
|
150
|
+
/\b(?:op te slaan en\/of te (?:raadplegen|openen|lezen)|opslaan en\/of (?:openen|raadplegen|lezen)|slaan informatie\b.{0,60}\bop en\/of)\b/gi,
|
|
151
|
+
/\bonze partners vragen om (?:jouw|uw|je) toestemming\b/gi,
|
|
152
|
+
/\bwij en onze (?:\d+ )?partners\b/gi,
|
|
153
|
+
/\b(?:gebruiken|gebruikt|plaatsen|plaatst)\b(?: \S+){0,3} cookies\b/gi,
|
|
154
|
+
/\baccepteer (?:alles|alle cookies)\b/gi,
|
|
155
|
+
// Dutch words only: "tracking cookies" and "marketing cookies" are also English prose and footer links
|
|
156
|
+
/\b(?:analytische|functionele|essentiële|noodzakelijke) cookies\b/gi,
|
|
88
157
|
|
|
89
158
|
// Spanish (ES)
|
|
90
159
|
/(si|al) contin[úu]a[sr]?( navegando)?.{0,100} cookie/gi,
|
|
@@ -102,6 +171,15 @@ export const DETECT_PATTERNS = [
|
|
|
102
171
|
/nosotros y nuestros( \d+)? (socios|proveedores).{0,180} cookies/gi,
|
|
103
172
|
/recopilamos y almacenamos datos de usted y de su dispositivo/gi,
|
|
104
173
|
/utilizamos tecnolog[ií]as como las cookies/gi,
|
|
174
|
+
/\b(?:almacenar|almacenamos) y\/o (?:acceder|accedemos)\b/gi,
|
|
175
|
+
/\bnuestros socios solicitan su consentimiento\b/gi,
|
|
176
|
+
/\b(?:tanto nosotros como|nosotros y) nuestros (?:\d+ )?socios\b/gi,
|
|
177
|
+
/\b(?:aceptar|rechazar) todas\b|\bcontinuar sin aceptar\b|\bsolo las necesarias\b/gi,
|
|
178
|
+
/\bacept\w* (?:\S+ ){0,3}uso de (?:las )?cookies\b/gi,
|
|
179
|
+
/\bcookies (?:técnicas|analíticas|propias|de terceros|opcionales|necesarias)\b/gi,
|
|
180
|
+
/\blas cookies nos (?:ayudan|permiten)\b/gi,
|
|
181
|
+
/\b(?:instalamos|empleamos)\b(?: \S+){0,4} cookies\b/gi,
|
|
182
|
+
/\bacept(?:a|ar|as)? (?:el uso de |las )?(?:\S+ )?cookies\b|\bnecesitamos usar cookies\b/gi,
|
|
105
183
|
|
|
106
184
|
// Polish (PL)
|
|
107
185
|
// examples:
|
|
@@ -132,10 +210,11 @@ export const DETECT_PATTERNS = [
|
|
|
132
210
|
// Catalan (CA)
|
|
133
211
|
/cookies pròpies i de tercers/gi,
|
|
134
212
|
/utilitzem galetes/gi,
|
|
135
|
-
|
|
213
|
+
/únicament utilitza galetes pròpies amb finalitat tècnica\b/gi,
|
|
136
214
|
/este lloc web utilitza només cookies tècniques necessàries per al seu funcionament/gi,
|
|
137
215
|
/utilitza cookies tècniques,\s*de personalització i anàlisi/gi,
|
|
138
216
|
/utilitzem cookies i altres tecnologies/gi,
|
|
217
|
+
/\b(?:utilitz\w*|fa servir|fem servir|usem)\b(?: \S+){0,3} (?:cookies|galetes)\b/gi,
|
|
139
218
|
|
|
140
219
|
// Basque (EU)
|
|
141
220
|
/cookie propio eta hirugarrenenak helburu teknikoarekin erabiltzen ditu/gi,
|
|
@@ -169,7 +248,18 @@ export const DETECT_PATTERNS = [
|
|
|
169
248
|
/(?:usiamo|utilizziamo).{0,20}cookie/gi,
|
|
170
249
|
/sito.{0,50}(?:usa|utilizza).{0,20}cookie/gi,
|
|
171
250
|
/noi e i nostri.{0,20}partner.{0,100}cookie/gi,
|
|
172
|
-
|
|
251
|
+
/\b(?:utilizziamo|usiamo|impieghiamo|installiamo)\b(?: \S+){0,3} cookies?\b/gi,
|
|
252
|
+
/\b(?:utilizza|utilizzano|usa|usano|impiega|installa|fa uso di)\b(?: \S+){0,3} cookies?\b/gi,
|
|
253
|
+
/\bcookies? (?:tecnici|di profilazione|di terze parti|analitici|statistici|di marketing)\b/gi,
|
|
254
|
+
/\b(?:acconsent|accett)\w*\b.{0,40}\b(?:uso|utilizzo|installazione)\b.{0,15}\bcookies?\b/gi,
|
|
255
|
+
/\b(?:continuando|proseguendo)(?: la| nella)? navigazione\b.{0,80}\b(?:accett|acconsent)\w*/gi,
|
|
256
|
+
/\b(?:accetta|accetto|accettare|rifiuta|rifiuto|rifiutare)(?: tutti| tutto)\b/gi,
|
|
257
|
+
/\b(?:continua|prosegui|chiudi) senza accettare\b/gi,
|
|
258
|
+
/\brifiuta e abbonati\b/gi,
|
|
259
|
+
/\bconsenso (?:all.(?:uso|utilizzo) (?:dei |di )?)?cookies?\b/gi,
|
|
260
|
+
/\b(?:insieme ai|con i) nostri (?:\d+ )?partner\b/gi,
|
|
261
|
+
/\bterze parti selezionate\b/gi,
|
|
262
|
+
/\b(?:archiviare|archiviamo|memorizzare|memorizziamo) e\/o (?:accedere|accediamo)\b/gi,
|
|
173
263
|
|
|
174
264
|
// Swedish (SV)
|
|
175
265
|
// e.g. "vi använder cookies", "vi använder spårningstekniker såsom cookies", "webbplatsen använder kakor"
|
|
@@ -507,29 +597,12 @@ export const BUTTON_NEVER_MATCH_PATTERNS = [
|
|
|
507
597
|
/подписатьс|подписк|оплатит|оплачива/is,
|
|
508
598
|
];
|
|
509
599
|
|
|
510
|
-
// Popup body-text patterns that suppress heuristic detection. Currently targets age gates and adult-content disclaimers whose "reject" button leads to a dead end.
|
|
511
|
-
// Applied only to popup-scoped text (via getActionablePopups); NOT applied to full-document detection, where these terms produce too many false positives.
|
|
512
|
-
export const DETECT_NEVER_MATCH_PATTERNS = [
|
|
513
|
-
// e.g. "age verification", "age confirmation", "age check", "age gate", "age restriction"
|
|
514
|
-
/age\s+(?:verification|confirmation|check|gate|restriction)/i,
|
|
515
|
-
// e.g. "over 18 years", "at least 21 years", "older than 21", "18+"
|
|
516
|
-
/(?:over|above|at\s*least|minimum|older\s+than)\s*(?:18|21)\s*(?:years|yo|y\.?o\.?|\+)?/i,
|
|
517
|
-
// e.g. "18 years of age", "18+ years old", "21 years or older"
|
|
518
|
-
/(?:18|21)\s*(?:\+|years?)\s*(?:of\s*age|or\s*older|or\s*above)/i,
|
|
519
|
-
// e.g. "I am 18+", "I am over 18", "I'm 21 or older"
|
|
520
|
-
/(?:i'?m|i\s*am)\s*(?:over|above|at\s*least)?\s*(?:18|21)(?:\+|\s*(?:or\s*older|years))?/i,
|
|
521
|
-
// e.g. "you must be 18", "users must be at least 21", "visitors must be over 18"
|
|
522
|
-
/(?:you|users?|visitors?)\s+must\s+be\s+(?:over|above|at\s*least)?\s*(?:18|21)/i,
|
|
523
|
-
// e.g. "adult oriented material", "adult content", "adult-only website"
|
|
524
|
-
/adult[\s-]+(?:oriented|only|content|material|websites?)/i,
|
|
525
|
-
];
|
|
526
|
-
|
|
527
600
|
export const SETTINGS_PATTERNS = [
|
|
528
601
|
// Multilingual "open customization" patterns: a customization verb next to a
|
|
529
602
|
// cookie/preference/settings/options/details/purposes noun (both word orders).
|
|
530
603
|
// The negative lookahead avoids policy links and save/confirm/accept phrases (those are accept/acknowledge/other).
|
|
531
|
-
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)
|
|
532
|
-
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(cookies?|preferences?|settings?|options?|choices?|controls?|details?|purposes?|services?|consent|einstellung\w*|optionen|präferenzen|einzelheiten|zwecke|dienste|datenschutz\w*|auswahl|voorkeur\w*|instelling\w*|opties|diensten|préférences|paramètres|réglages|choix|détails|finalités|témoins|preferencia\w*|opciones|ajustes|configuraci\w*|detalles|servicios|elección|preferencj\w*|ustawie\w*|opcje|szczegół\w*|cele|galetes)\b(.{0,14}\W)?(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)
|
|
604
|
+
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)(?!\w).{0,20}(cookies?|preferences?|settings?|options?|choices?|controls?|details?|purposes?|services?|consent|einstellung\w*|optionen|präferenzen|einzelheiten|zwecke|dienste|datenschutz\w*|auswahl|voorkeur\w*|instelling\w*|opties|diensten|préférences|paramètres|réglages|choix|détails|finalités|témoins|preferencia\w*|opciones|ajustes|configuraci\w*|detalles|servicios|elección|preferencj\w*|ustawie\w*|opcje|szczegół\w*|cele|galetes)\b/is,
|
|
605
|
+
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(cookies?|preferences?|settings?|options?|choices?|controls?|details?|purposes?|services?|consent|einstellung\w*|optionen|präferenzen|einzelheiten|zwecke|dienste|datenschutz\w*|auswahl|voorkeur\w*|instelling\w*|opties|diensten|préférences|paramètres|réglages|choix|détails|finalités|témoins|preferencia\w*|opciones|ajustes|configuraci\w*|detalles|servicios|elección|preferencj\w*|ustawie\w*|opcje|szczegół\w*|cele|galetes)\b(.{0,14}\W)?(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)(?!\w)/is,
|
|
533
606
|
|
|
534
607
|
// settings noun + cookies, e.g. "paramètres des cookies", "ajustes de cookies", "instellingen voor cookies en diensten"
|
|
535
608
|
/^(paramètres|préférences|réglages|ajustes|opciones|elección|preferencias|instellingen)( (de|des|les|voor|van))? cookies( (et des|en|y) (services|diensten|servicios))?$/is,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Required-literal prefilter for heuristic detect patterns (see docs/heuristic-prefilter.md): each built-in pattern has
|
|
3
|
+
* literals that any match must contain, generated at build time into heuristic-literals.ts. A text is checked for all
|
|
4
|
+
* of them in one pass, and a pattern whose literals are all absent can't match, so it is skipped without changing any
|
|
5
|
+
* result.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Finds which literals a text contains in one pass: a zero-width lookahead over the literals, longest first, reports
|
|
10
|
+
* the longest one starting at each position, and any other literal starting there is a prefix of it.
|
|
11
|
+
*/
|
|
12
|
+
export function literalIndex(all: string[]): { present: (lower: string) => Set<string> } {
|
|
13
|
+
const distinct = [...new Set(all)].sort((a, b) => b.length - a.length);
|
|
14
|
+
if (distinct.length === 0) {
|
|
15
|
+
return { present: () => new Set() };
|
|
16
|
+
}
|
|
17
|
+
const escape = (l: string) => l.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
18
|
+
const any = new RegExp(`(?=(${distinct.map(escape).join('|')}))`, 'g');
|
|
19
|
+
// which literals a reported one implies (itself and its prefixes), worked out only for literals a page contains
|
|
20
|
+
const implies = new Map<string, string[]>();
|
|
21
|
+
const impliedBy = (m: string) => {
|
|
22
|
+
let list = implies.get(m);
|
|
23
|
+
if (!list) {
|
|
24
|
+
list = distinct.filter((l) => m.startsWith(l));
|
|
25
|
+
implies.set(m, list);
|
|
26
|
+
}
|
|
27
|
+
return list;
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
present(lower: string) {
|
|
31
|
+
const found = new Set<string>();
|
|
32
|
+
for (const m of lower.matchAll(any)) {
|
|
33
|
+
if (!found.has(m[1])) {
|
|
34
|
+
impliedBy(m[1]).forEach((l) => found.add(l));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return found;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|