cuonztech-privacy-chaos-gate 0.3.6 → 0.3.8

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/README.md CHANGED
@@ -120,9 +120,9 @@ Der Report führt **Befunde** (ausgelöste Regeln), **Hinweise** und **beobachte
120
120
 
121
121
  **Hinweise sind kein Blocker.** Rein funktionale Drittanbieter (etwa Google Fonts) und cookielose
122
122
  Reichweitenmessung (etwa Plausible, Fathom) erscheinen als Hinweis und blockieren das Gate nicht. Ebenso Befunde, die nach dem gewählten Rechtsraum nur Hinweis sind
123
- (zum Beispiel Tracker vor der Einwilligung mit `--jurisdiction CH`, Opt-out-Modell): Sie stehen mit ihrer Einordnung
123
+ (zum Beispiel Tracker vor der Einwilligung mit `--jurisdiction US-CA`, Opt-out-Modell): Sie stehen mit ihrer Einordnung
124
124
  in der Liste «Hinweise», nicht im Befundregister. Ein Szenario, das nur wegen solcher Hinweise auffiel, gilt als
125
- «bestanden nach CH (opt-out)». Mit `--strict` blockieren auch Hinweise.
125
+ «bestanden nach US-CA (opt-out)». Mit `--strict` blockieren auch Hinweise.
126
126
 
127
127
  **Nicht prüfbar heisst: mit Grund.** Der Report führt je nicht prüfbarem Szenario den Grund in einer eigenen Liste
128
128
  «Warum nicht prüfbar» (auch in der Konsole, in der Step-Summary und in `report.json` unter `gate.uncheckableReasons`).
@@ -140,6 +140,15 @@ Version (User-Agent und Client-Hints ohne «Headless»), damit die Seite ihren B
140
140
  Besucher. `report.json` nennt die verwendete Kennung unter `browserUserAgent`. Bot-Schutz wird nicht umgangen
141
141
  (`navigator.webdriver` bleibt gesetzt); er führt wie oben beschrieben zu «nicht prüfbar».
142
142
 
143
+ **Besucherprofil und Land.** Seiten zeigen je nach Herkunft des Besuchers andere Banner. Gemessen an Schweizer Seiten
144
+ (November 2026) entscheidet dabei die IP-Adresse, nicht Sprache oder Zeitzone des Browsers. CPCG trennt deshalb:
145
+ `--visitor ch|eu` setzt Sprache und Zeitzone fest (Standard `ch`; vorher galten die des Rechners, auf einem GitHub-Runner
146
+ meist Englisch/USA), damit Läufe vergleichbar sind. Einen Besucher aus einem anderen Land simuliert erst `--proxy` mit
147
+ einem Ausgang dort. Mit `--visitor eu` oder `--proxy` misst CPCG das Land der eigenen IP über
148
+ `https://www.cloudflare.com/cdn-cgi/trace` (ein Abruf, nur in diesen Fällen) und schreibt es in den Report (`visitor`);
149
+ passt es nicht zum Profil, steht eine Warnung dabei. Der Proxy kommt nie aus einer `.env`: ein Proxy könnte
150
+ Tracker-Requests verschlucken und so das Gate beeinflussen. Die Erreichbarkeitsprüfung vor dem Scan läuft ohne Proxy.
151
+
143
152
  **Fortschritt und Zeitlimit.** Während des Scans zeigt die Konsole je Szenario eine Zeile («[3/17] fast-click (nach
144
153
  52 s)»). Jedes Szenario und jede Vor- und Schlussprüfung hat eine Obergrenze: je Szenario seine Navigationen mal
145
154
  `--timeout-ms` (mindestens 120 s, Unterseiten zuzüglich ihres Zeitbudgets), je Vorprüfung drei Navigationsfristen
@@ -183,6 +192,8 @@ cpcg --url https://staging.example.com \
183
192
  | `--settings-selector <css>` | Eigener Selektor des Einstellungen-Buttons |
184
193
  | `--banner-frame <teilstring>` | Teil der URL des iframes, in dem der Banner liegt (CMP im Frame); findet der Scan keinen solchen Frame, warnt er |
185
194
  | `--banner-wait <sekunden>` | Wartefenster auf einen spät erscheinenden Banner, 1 bis 60 (Standard 8; Umgebung `CPCG_BANNER_WAIT`). Mit Angabe wird das Fenster ausgeschöpft, ebenso bei `--accept-selector`/`--reject-selector`; die Schlussprüfung wartet zusätzlich eine Nachfrist |
195
+ | `--visitor <profil>` | Besucherprofil: `ch` (Sprache de-CH, Zeitzone Zürich, Standard) oder `eu` (de-DE, Berlin); feste Sprache und Zeitzone statt der des Rechners (Umgebung `CPCG_VISITOR`). Das Land der IP ändert nur `--proxy` (siehe «Besucherprofil und Land») |
196
+ | `--proxy <url>` | Proxy für alle Browser-Zugriffe, z. B. ein Ausgang in der EU: `http(s)://[user:pass@]host:port` oder `socks5://host:port` (Umgebung `CPCG_PROXY`, nie aus `.env`). Report und Konsole nennen den Proxy ohne Zugangsdaten und das gemessene IP-Land |
186
197
  | `--max-subpages <n>` | Obergrenze der Unterseiten-Stichprobe (Szenario `subpage-spa`), 1 bis 40 (Standard 12; Umgebung `CPCG_MAX_SUBPAGES`); das Zeitbudget wächst moderat mit (45 s bis 12, 90 s bis 24, sonst 120 s) |
187
198
  | `--sitemap` | Sitemap-Tiefenlauf: `subpage-spa` prüft Unterseiten aus `robots.txt`/`sitemap.xml` (auch Index und gzip) zusammen mit den Links der Startseite, reihum nach Pfadbereich, bis `--deep-budget` verbraucht ist; `--max-subpages` gilt dann nicht (Umgebung `CPCG_SITEMAP`) |
188
199
  | `--deep-budget <s>` | Zeitbudget des Tiefenlaufs für die Unterseiten, 30 bis 3600 s (Standard 300; Umgebung `CPCG_DEEP_BUDGET`) |
@@ -310,6 +321,8 @@ ohne sie werden sie mit Hinweis übersprungen.
310
321
  | `ignore` | leer | Befunde ausnehmen (Tracker-Name oder Host-Muster, eine Angabe je Zeile oder kommagetrennt) |
311
322
  | `accept-selector`, `reject-selector`, `settings-selector` | leer | Eigene CSS-Selektoren der Banner-Buttons (eine Angabe je Zeile) |
312
323
  | `banner-frame` | leer | Teil der URL des iframes mit dem Banner |
324
+ | `visitor` | leer (CLI: ch) | Besucherprofil `ch` oder `eu` (Sprache und Zeitzone) |
325
+ | `proxy` | leer | Proxy für alle Browser-Zugriffe (aus Secrets, wenn mit Zugangsdaten); wird als `CPCG_PROXY` übergeben, nie in der Kommandozeile |
313
326
  | `max-subpages` | leer (CLI: 12) | Höchstzahl verlinkter Unterseiten, die auf Tracker geprüft werden (max. 40; mehr dauert länger) |
314
327
  | `sitemap` | `false` | Sitemap-Tiefenlauf (siehe `--sitemap`) |
315
328
  | `deep-budget` | leer (CLI: 300) | Zeitbudget des Tiefenlaufs in Sekunden (30 bis 3600) |
@@ -393,29 +406,32 @@ die Szenarien sind dann nicht prüfbar und der Fix gilt nicht als verifiziert. D
393
406
  in der Action ebenso). Der Rechtsraum entscheidet, was das Gate blockiert; gewählt mehrere, gewinnt der strengste. Was nach
394
407
  einem Rechtsraum nicht blockiert, steht als Hinweis mit Begründung im Report. `--strict` lässt auch Hinweise blockieren.
395
408
 
396
- | Regel (Befund) | EU, UK, BR (opt-in) | CH, US-CA (opt-out) | ROW |
397
- |---|---|---|---|
398
- | Tracker vor der Einwilligung (`pre-consent-tracking`), auch ohne gespeicherte Entscheidung nach gelöschtem Speicher (`tracking-without-consent`) | blockiert (funktionale Drittanbieter und cookielose Reichweitenmessung: Hinweis) | Hinweis | Hinweis |
399
- | Tracker nach Ablehnen, auch nach beschädigter gespeicherter Ablehnung oder verlorenem Klick-Rennen mit registrierter Ablehnung (`tracking-after-deny`) | blockiert | blockiert | Hinweis |
400
- | Keine Ablehnen-Möglichkeit (`no-reject-option`) | blockiert | blockiert | Hinweis |
401
- | Banner ohne Auswahl (`no-consent-choice`): nur Hinweistext, Infolink und Schliessen-Kreuz, weder Akzeptieren noch Ablehnen, und Tracking vor der Entscheidung | blockiert | blockiert | Hinweis |
402
- | Werbe-Tracker trotz Global Privacy Control (`gpc-ignored`) | Hinweis | US-CA: blockiert (nur Werbung); CH: Hinweis | Hinweis |
403
- | Nach Ablehnen meldet der IAB-TCF-String Zustimmung zu Zwecken (`tcf-consent-mismatch`) | blockiert | blockiert | Hinweis |
404
- | Tracker-Request nach Ablehnen, dessen IAB-TCF-String die Ablehnung trägt (weder Zustimmung noch berechtigtes Interesse) | Hinweis (mit `--strict` blockierend) | Hinweis | Hinweis |
405
- | Tracker-Request nach Ablehnen, dessen IAB-TCF-String berechtigtes Interesse beansprucht (Anbieter darf ohne Einwilligung verarbeiten) | blockiert (`tracking-after-deny`, mit Angabe) | blockiert | Hinweis |
406
- | Übrige Regeln (Widerruf, abgelehnte Kategorie, Consent-Mode-Widerspruch, doppelte Events, Embeds) | blockiert | blockiert | Hinweis |
409
+ | Regel (Befund) | EU, UK, BR (opt-in) | CH (Widerspruch vor Aktivierung) | US-CA (opt-out) | ROW |
410
+ |---|---|---|---|---|
411
+ | Tracker vor der Einwilligung (`pre-consent-tracking`), auch ohne gespeicherte Entscheidung nach gelöschtem Speicher (`tracking-without-consent`) | blockiert (funktionale Drittanbieter und cookielose Reichweitenmessung: Hinweis) | blockiert für Werbung, Marketing und Analyse (funktionale Drittanbieter und cookielose Reichweitenmessung: Hinweis) | Hinweis | Hinweis |
412
+ | Tracker nach Ablehnen, auch nach beschädigter gespeicherter Ablehnung oder verlorenem Klick-Rennen mit registrierter Ablehnung (`tracking-after-deny`) | blockiert | blockiert | blockiert | Hinweis |
413
+ | Keine Ablehnen-Möglichkeit (`no-reject-option`): weder auf der ersten Ebene noch in den (geöffneten) Einstellungen; ein Schliessen-Kreuz zählt nur dann nicht als Ablehnen, wenn nach Schliessen und Neuladen weiter Tracker laden (gemessen in einem frischen Browser) | blockiert | blockiert | blockiert | Hinweis |
414
+ | Banner ohne Auswahl (`no-consent-choice`): nur Hinweistext, Infolink und Schliessen-Kreuz, weder Akzeptieren noch Ablehnen, und Tracking vor der Entscheidung | blockiert | blockiert | blockiert | Hinweis |
415
+ | Werbe-Tracker trotz Global Privacy Control (`gpc-ignored`) | Hinweis | Hinweis | blockiert (nur Werbung) | Hinweis |
416
+ | Nach Ablehnen meldet der IAB-TCF-String Zustimmung zu Zwecken (`tcf-consent-mismatch`) | blockiert | blockiert | blockiert | Hinweis |
417
+ | Tracker-Request nach Ablehnen, dessen IAB-TCF-String die Ablehnung trägt (weder Zustimmung noch berechtigtes Interesse) | Hinweis (mit `--strict` blockierend) | Hinweis | Hinweis | Hinweis |
418
+ | Tracker-Request nach Ablehnen, dessen IAB-TCF-String berechtigtes Interesse beansprucht (Anbieter darf ohne Einwilligung verarbeiten) | blockiert (`tracking-after-deny`, mit Angabe) | blockiert | blockiert | Hinweis |
419
+ | Übrige Regeln (Widerruf, abgelehnte Kategorie, Consent-Mode-Widerspruch, doppelte Events, Embeds) | blockiert | blockiert | blockiert | Hinweis |
407
420
 
408
421
  **Wie die Tabelle zu lesen ist:** Sie beschreibt die Regeln, die CPCG je Modell anwendet, und keine Rechtslage. Der Report nennt bei
409
- jeder Aussage das angewandte Modell, zum Beispiel «Nach CH (opt-out) Hinweis, nicht blockierend», und beschreibt nur, was
422
+ jeder Aussage das angewandte Modell, zum Beispiel «Nach US-CA (opt-out) Hinweis, nicht blockierend», und beschreibt nur, was
410
423
  gemessen wurde. Er sagt nicht, ob etwas rechtmässig oder rechtswidrig ist.
411
424
 
412
425
  - **opt-in** (EU, UK, BR): Tracker vor einer Einwilligung sind blockierend.
413
- - **opt-out** (CH, US-CA): Tracker vor einer Entscheidung sind ein Hinweis; blockierend sind Tracker nach «Ablehnen», ein Banner ohne
426
+ - **Widerspruch vor Aktivierung** (CH, seit 0.3.8): Werbe-, Marketing- und Analyse-Tracker vor einer Entscheidung sind blockierend;
427
+ rein funktionale Anbieter und cookielose Reichweitenmessung sind ein Hinweis. Quelle der Regel: EDÖB-Leitfaden Cookies V1.1
428
+ (06.10.2025), Ziff. 3.9 (keine Rechtsnorm). Bis 0.3.7 galt für CH das Modell opt-out.
429
+ - **opt-out** (US-CA): Tracker vor einer Entscheidung sind ein Hinweis; blockierend sind Tracker nach «Ablehnen», ein Banner ohne
414
430
  Ablehnen-Möglichkeit und ein Banner ohne Auswahl.
415
431
  - **notice-only** (ROW): kein Modell angewendet, nie blockierend.
416
432
 
417
433
  Welches Modell für Ihre Seite zutrifft, ist keine Entscheidung von CPCG: Die Zuordnung der Rechtsräume zu den Modellen ist eine
418
- Festlegung des Tools und eine offene Frage an die Anwaltsprüfung (`docs/LICENSE-PRUEFHINWEISE.md`, Punkte 13 und 16). Hat die
434
+ Festlegung des Tools (für CH nach Rechtsprüfung, für EU, UK, BR und US-CA offen: `docs/LICENSE-PRUEFHINWEISE.md`, Punkte 13 und 16). Hat die
419
435
  Seite Publikum aus der EU, gehört `EU` in die Liste; bei mehreren Rechtsräumen gilt der strengere.
420
436
 
421
437
  ## Entwicklung
package/action.yml CHANGED
@@ -65,6 +65,14 @@ inputs:
65
65
  description: "Part of the URL of the iframe that contains the consent banner (CMP inside a frame)"
66
66
  required: false
67
67
  default: ""
68
+ visitor:
69
+ description: "Visitor profile: ch (de-CH, Europe/Zurich, default) or eu (de-DE, Europe/Berlin). Fixes browser language and time zone; the country of the IP is only changed by proxy"
70
+ required: false
71
+ default: ""
72
+ proxy:
73
+ description: "Proxy for all browser requests, e.g. an exit in the EU (http(s)://[user:pass@]host:port or socks5://host:port) — from secrets if it contains credentials. Passed via the CPCG_PROXY environment variable, never on the command line. The measured IP country is in the report"
74
+ required: false
75
+ default: ""
68
76
  max-subpages:
69
77
  description: "Maximum number of linked subpages checked for trackers (default 12, max 40; larger values take longer)"
70
78
  required: false
@@ -188,7 +196,7 @@ runs:
188
196
  shell: bash
189
197
  env:
190
198
  ACTION_PATH: ${{ github.action_path }}
191
- CPCG_PINNED_VERSION: "0.3.6" # = package.json version; bei jedem Release mit anheben (tests/action-pin.test.ts prüft das)
199
+ CPCG_PINNED_VERSION: "0.3.8" # = package.json version; bei jedem Release mit anheben (tests/action-pin.test.ts prüft das)
192
200
  run: |
193
201
  set -euo pipefail
194
202
 
@@ -223,6 +231,7 @@ runs:
223
231
  CPCG_LLM_MODEL: ${{ inputs.llm-model }}
224
232
  CPCG_LICENSE: ${{ inputs.license }}
225
233
  CPCG_TARGET_HEADERS: ${{ inputs.target-headers }}
234
+ CPCG_PROXY: ${{ inputs.proxy }}
226
235
  GITHUB_TOKEN: ${{ inputs.github-token }}
227
236
  IN_STAGING_URL: ${{ inputs.staging-url }}
228
237
  IN_LLM_REMEDIATION: ${{ inputs.llm-remediation }}
@@ -237,6 +246,7 @@ runs:
237
246
  IN_SETTINGS_SELECTOR: ${{ inputs.settings-selector }}
238
247
  IN_BANNER_FRAME: ${{ inputs.banner-frame }}
239
248
  IN_MAX_SUBPAGES: ${{ inputs.max-subpages }}
249
+ IN_VISITOR: ${{ inputs.visitor }}
240
250
  IN_BANNER_WAIT: ${{ inputs.banner-wait }}
241
251
  IN_SITEMAP: ${{ inputs.sitemap }}
242
252
  IN_DEEP_BUDGET: ${{ inputs.deep-budget }}
@@ -321,6 +331,7 @@ runs:
321
331
  opt_lines settings-selector "$IN_SETTINGS_SELECTOR"
322
332
  opt_lines banner-frame "$IN_BANNER_FRAME"
323
333
  opt_lines max-subpages "$IN_MAX_SUBPAGES"
334
+ opt_lines visitor "${IN_VISITOR:-}"
324
335
  opt_lines banner-wait "$IN_BANNER_WAIT"
325
336
  opt_bool sitemap "${IN_SITEMAP:-false}"
326
337
  opt_lines deep-budget "${IN_DEEP_BUDGET:-}"
@@ -132,6 +132,15 @@ var LeakReportSchema = z.object({
132
132
  browserVersion: z.string().optional(),
133
133
  /** User-Agent, mit dem sich die Scan-Kontexte gemeldet haben (Chrome-Kennzeichen ohne «Headless»). */
134
134
  browserUserAgent: z.string().optional(),
135
+ /** Besucherprofil des Laufs: Sprache, Zeitzone, Proxy (ohne Zugangsdaten) und gemessenes IP-Land. */
136
+ visitor: z.object({
137
+ profile: z.enum(["ch", "eu"]),
138
+ locale: z.string(),
139
+ timezoneId: z.string(),
140
+ proxy: z.string().optional(),
141
+ ipCountry: z.string().optional(),
142
+ ipCountryMatches: z.boolean().optional()
143
+ }).optional(),
135
144
  /** `--har`: in diesem Lauf geschriebene HAR-Dateien, relativ zum Report-Ordner (eigener Unterordner je Lauf). */
136
145
  harFiles: z.array(z.string()).optional(),
137
146
  /** Herkunft des Laufs: Version, Scan-Konfiguration ohne Geheimnisse und deren SHA-256 (`provenance.ts`). */
@@ -328,6 +337,13 @@ var GateConfigSchema = z.object({
328
337
  * bisherige Verhalten (8 s, bei Seiten ohne Banner-Hinweis früher beendet); mit Angabe wird das Fenster ausgeschöpft.
329
338
  */
330
339
  bannerWaitSeconds: z.number().min(1).max(60).optional(),
340
+ /**
341
+ * Besucherprofil (`--visitor`): feste Sprache und Zeitzone des Browsers (ch: de-CH/Zürich, eu: de-DE/Berlin), damit
342
+ * der Lauf nicht von der Maschine abhängt. Das Land der IP bestimmt nur `proxy`.
343
+ */
344
+ visitor: z.enum(["ch", "eu"]).default("ch"),
345
+ /** Proxy für alle Browser-Zugriffe (`--proxy`, Env `CPCG_PROXY`), z. B. ein Ausgang in der EU. Enthält ggf. Zugangsdaten: nie ausgeben. */
346
+ proxy: z.string().optional(),
331
347
  /** Hinweise zur Eingabe (z. B. leerer Selektor), die der Scanner in `scannerWarnings` übernimmt. */
332
348
  configWarnings: z.array(z.string()).optional(),
333
349
  /** Scanner-Overrides für eigene Banner (CSS-Selektoren bzw. Teilstring der Banner-Frame-URL). */
@@ -364,16 +380,22 @@ var EXIT = {
364
380
  };
365
381
 
366
382
  // src/core/legal/jurisdictions.ts
383
+ var CONSENT_MODEL_LABEL = {
384
+ "opt-in": "opt-in",
385
+ objection: "Widerspruch vor Aktivierung",
386
+ "opt-out": "opt-out",
387
+ "notice-only": "notice-only"
388
+ };
367
389
  var JURISDICTIONS = {
368
390
  CH: {
369
391
  code: "CH",
370
392
  label: "Schweiz",
371
- frameworks: ["revDSG (nDSG)", "FDPIC-Richtlinien", "UWG (irref\xFChrende Praktiken)"],
372
- consentModel: "opt-out",
373
- priorOptInRequired: true,
393
+ frameworks: ["FMG Art. 45c", "DSG", "ED\xD6B-Leitfaden Cookies V1.1 (06.10.2025)"],
394
+ consentModel: "objection",
395
+ priorOptInRequired: false,
374
396
  consentModeV2: "recommended",
375
- summary: "CPCG wendet hier das Modell opt-out an. Regeln dieses Modells: Tracker vor einer Entscheidung sind ein Hinweis (nicht blockierend). Blockierend sind Tracker nach \xABAblehnen\xBB, Tracker bei besch\xE4digter Ablehnung, ein Banner ohne Ablehnen-M\xF6glichkeit und ein Banner ohne Auswahl.",
376
- note: "Regelwerk von CPCG, technische Beobachtung, keine Rechtsberatung und keine Aussage, was rechtlich verlangt ist. Bei EU-Zielgruppe zus\xE4tzlich --jurisdiction EU setzen: bei mehreren Rechtsr\xE4umen gilt der strengere."
397
+ summary: "CPCG wendet hier das Modell \xABWiderspruch vor Aktivierung\xBB an (Quelle der Regel: ED\xD6B-Leitfaden Cookies V1.1, Ziff. 3.9). Regeln dieses Modells: Werbe-, Marketing- und Analyse-Tracker vor einer Entscheidung sind blockierend; rein funktionale Anbieter und cookielose Reichweitenmessung sind ein Hinweis. Blockierend sind ebenso Tracker nach \xABAblehnen\xBB, Tracker bei besch\xE4digter Ablehnung, ein Banner ohne Ablehnen-M\xF6glichkeit und ein Banner ohne Auswahl.",
398
+ note: "Regelwerk von CPCG, technische Beobachtung, keine Rechtsberatung und keine Aussage, was rechtlich verlangt ist. Der ED\xD6B-Leitfaden ist keine Rechtsnorm. Bei EU-Zielgruppe zus\xE4tzlich --jurisdiction EU setzen: bei mehreren Rechtsr\xE4umen gilt der strengere."
377
399
  },
378
400
  EU: {
379
401
  code: "EU",
@@ -442,13 +464,15 @@ function verdictFor(profile, ruleId, trackerCategory) {
442
464
  if (rule === "gpc-ignored") return profile.code === "US-CA" && trackerCategory === "marketing" ? "block" : "hint";
443
465
  if (rule === "tracking-after-deny" || rule === "no-reject-option" || rule === "no-consent-choice") return "block";
444
466
  if (rule === "pre-consent-tracking") {
445
- if (profile.consentModel === "opt-in") return trackerCategory === "functional" || trackerCategory === "cookieless-analytics" ? "hint" : "block";
467
+ if (profile.consentModel === "opt-in" || profile.consentModel === "objection") {
468
+ return trackerCategory === "functional" || trackerCategory === "cookieless-analytics" ? "hint" : "block";
469
+ }
446
470
  return "hint";
447
471
  }
448
472
  return "block";
449
473
  }
450
474
  function jurisdictionModelLabel(profiles) {
451
- return profiles.map((p) => `${p.code} (${p.consentModel})`).join(" + ");
475
+ return profiles.map((p) => `${p.code} (${CONSENT_MODEL_LABEL[p.consentModel]})`).join(" + ");
452
476
  }
453
477
  function hintReasonFor(profiles, ruleId, trackerCategory) {
454
478
  const label = jurisdictionModelLabel(profiles);
@@ -465,6 +489,9 @@ function hintReasonFor(profiles, ruleId, trackerCategory) {
465
489
  if (rule === "pre-consent-tracking" && trackerCategory === "functional") {
466
490
  return `Nach ${label} Hinweis: vor der Einwilligung beobachtet; CPCG stuft den Anbieter als funktional ein (kein Werbe- oder Analyse-Tracker).`;
467
491
  }
492
+ if (rule === "pre-consent-tracking" && trackerCategory === "cookieless-analytics") {
493
+ return `Nach ${label} Hinweis: vor der Einwilligung beobachtet; cookielose Reichweitenmessung (keine Cookies, kein Zugriff auf das Ger\xE4t).`;
494
+ }
468
495
  if (rule === "pre-consent-tracking") {
469
496
  return `Nach ${label} Hinweis, nicht blockierend: vor der Einwilligung beobachtet. Regel im Modell opt-out: Tracker vor einer Entscheidung sind ein Hinweis; blockierend sind Tracker nach \xABAblehnen\xBB und ein Banner ohne Ablehnen-M\xF6glichkeit.`;
470
497
  }
@@ -477,7 +504,14 @@ function severityForPreConsentLeak(profile) {
477
504
  if (profile.consentModel === "notice-only") {
478
505
  return { severity: "P2", framing: "Modell notice-only: kein Einwilligungsmodell angewendet, Befunde werden neutral dokumentiert und sind nie blockierend." };
479
506
  }
480
- const severity = profile.priorOptInRequired && profile.consentModeV2 === "required" ? "P0" : profile.priorOptInRequired ? "P1" : "P2";
507
+ const blocksPreConsent = profile.consentModel === "opt-in" || profile.consentModel === "objection";
508
+ const severity = blocksPreConsent ? profile.consentModeV2 === "required" ? "P0" : "P1" : "P2";
509
+ if (profile.consentModel === "objection") {
510
+ return {
511
+ severity,
512
+ framing: "Modell \xABWiderspruch vor Aktivierung\xBB: Werbe-, Marketing- und Analyse-Tracker vor einer Entscheidung sind nach der CPCG-Regel blockierend (rein funktionale Anbieter und cookielose Messung: Hinweis). Quelle der Regel: ED\xD6B-Leitfaden Cookies V1.1, Ziff. 3.9."
513
+ };
514
+ }
481
515
  if (profile.consentModel === "opt-in") {
482
516
  return {
483
517
  severity,
@@ -1464,6 +1498,91 @@ async function fetchWithTargetHeaders(url, init, headers, origins, fetchImpl = f
1464
1498
  }
1465
1499
  }
1466
1500
 
1501
+ // src/core/scanner/visitor.ts
1502
+ var EU_COUNTRIES = [
1503
+ "AT",
1504
+ "BE",
1505
+ "BG",
1506
+ "CY",
1507
+ "CZ",
1508
+ "DE",
1509
+ "DK",
1510
+ "EE",
1511
+ "ES",
1512
+ "FI",
1513
+ "FR",
1514
+ "GR",
1515
+ "HR",
1516
+ "HU",
1517
+ "IE",
1518
+ "IT",
1519
+ "LT",
1520
+ "LU",
1521
+ "LV",
1522
+ "MT",
1523
+ "NL",
1524
+ "PL",
1525
+ "PT",
1526
+ "RO",
1527
+ "SE",
1528
+ "SI",
1529
+ "SK"
1530
+ ];
1531
+ var VISITOR_PROFILES = {
1532
+ ch: { name: "ch", label: "Schweiz", locale: "de-CH", timezoneId: "Europe/Zurich", countries: ["CH", "LI"] },
1533
+ eu: { name: "eu", label: "EU", locale: "de-DE", timezoneId: "Europe/Berlin", countries: EU_COUNTRIES }
1534
+ };
1535
+ var VISITOR_NAMES = Object.keys(VISITOR_PROFILES);
1536
+ function isVisitorName(v) {
1537
+ return VISITOR_NAMES.includes(v);
1538
+ }
1539
+ var PROXY_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "socks5:"]);
1540
+ function parseProxy(raw) {
1541
+ let u;
1542
+ try {
1543
+ u = new URL(raw.trim());
1544
+ } catch {
1545
+ return { ok: false, reason: "keine g\xFCltige URL (erwartet z. B. http://host:3128)" };
1546
+ }
1547
+ if (!PROXY_SCHEMES.has(u.protocol)) return { ok: false, reason: `Schema \xAB${u.protocol.replace(/:$/, "")}\xBB nicht unterst\xFCtzt (http, https, socks5)` };
1548
+ if (!u.hostname) return { ok: false, reason: "Host fehlt" };
1549
+ if (u.pathname && u.pathname !== "/") return { ok: false, reason: "Pfad nicht erlaubt (nur Schema, Host und Port)" };
1550
+ if (u.protocol === "socks5:" && (u.username || u.password)) {
1551
+ return { ok: false, reason: "SOCKS5 mit Zugangsdaten wird vom Browser nicht unterst\xFCtzt (http/https-Proxy verwenden)" };
1552
+ }
1553
+ const server = `${u.protocol}//${u.host}`;
1554
+ let username;
1555
+ let password;
1556
+ try {
1557
+ username = u.username ? decodeURIComponent(u.username) : void 0;
1558
+ password = u.password ? decodeURIComponent(u.password) : void 0;
1559
+ } catch {
1560
+ return { ok: false, reason: "Zugangsdaten falsch kodiert (Sonderzeichen als %XX angeben)" };
1561
+ }
1562
+ return { ok: true, proxy: { server, ...username ? { username } : {}, ...password ? { password } : {} } };
1563
+ }
1564
+ function redactProxy(raw) {
1565
+ const p = parseProxy(raw);
1566
+ return p.ok ? p.proxy.server : "(ung\xFCltig)";
1567
+ }
1568
+ var IP_COUNTRY_URL = "https://www.cloudflare.com/cdn-cgi/trace";
1569
+ function parseTraceCountry(text) {
1570
+ const m = /^loc=([A-Z][A-Z0-9])\s*$/m.exec(text);
1571
+ return m && m[1] !== "XX" ? m[1] : void 0;
1572
+ }
1573
+ var TOR_COUNTRY = "T1";
1574
+ function countryLabel(country) {
1575
+ return country === TOR_COUNTRY ? "T1 (Tor-Netz, kein Land ausgewiesen)" : country;
1576
+ }
1577
+ function ipCountryMatches(profile, country) {
1578
+ return country ? profile.countries.includes(country) : void 0;
1579
+ }
1580
+ function visitorLine(v) {
1581
+ const p = VISITOR_PROFILES[v.profile];
1582
+ const ip = v.ipCountry ? `IP-Land ${countryLabel(v.ipCountry)}${v.ipCountryMatches === false && v.ipCountry !== TOR_COUNTRY ? " (passt nicht zum Profil)" : ""}` : "IP-Land nicht gemessen";
1583
+ return `${p.label} (${v.locale}, ${v.timezoneId})${v.proxy ? `, \xFCber Proxy ${v.proxy}` : ""}, ${ip}`;
1584
+ }
1585
+
1467
1586
  // src/config/index.ts
1468
1587
  var ENV_FILE_ALLOWED = /* @__PURE__ */ new Set([
1469
1588
  "OPENAI_API_KEY",
@@ -1609,6 +1728,17 @@ function resolveGateConfig(cliOptions) {
1609
1728
  deepBudgetSeconds = 300;
1610
1729
  }
1611
1730
  }
1731
+ const rawVisitor = String(present(cliOptions.visitor) ? cliOptions.visitor : present(env.CPCG_VISITOR) ? env.CPCG_VISITOR : "ch").trim().toLowerCase() || "ch";
1732
+ let visitor = "ch";
1733
+ if (isVisitorName(rawVisitor)) visitor = rawVisitor;
1734
+ else problems.push(`--visitor: ung\xFCltiger Wert "${rawVisitor}" (erwartet: ${VISITOR_NAMES.join(", ")})`);
1735
+ const rawProxy = present(cliOptions.proxy) ? String(cliOptions.proxy) : env.CPCG_PROXY;
1736
+ let proxy;
1737
+ if (present(rawProxy) && String(rawProxy).trim()) {
1738
+ const parsedProxy = parseProxy(String(rawProxy));
1739
+ if (parsedProxy.ok) proxy = String(rawProxy).trim();
1740
+ else problems.push(`--proxy: ${parsedProxy.reason}`);
1741
+ }
1612
1742
  const headerLines = present(cliOptions.targetHeader) && (!Array.isArray(cliOptions.targetHeader) || cliOptions.targetHeader.length > 0) ? Array.isArray(cliOptions.targetHeader) ? cliOptions.targetHeader : [cliOptions.targetHeader] : (env.CPCG_TARGET_HEADERS ?? "").split(/\r?\n/);
1613
1743
  const parsedHeaders = parseTargetHeaders(headerLines);
1614
1744
  problems.push(...parsedHeaders.problems);
@@ -1707,6 +1837,8 @@ function resolveGateConfig(cliOptions) {
1707
1837
  verifyWaitSeconds,
1708
1838
  targetHeaders,
1709
1839
  bannerWaitSeconds,
1840
+ visitor,
1841
+ ...proxy ? { proxy } : {},
1710
1842
  ...configWarnings.length > 0 ? { configWarnings } : {}
1711
1843
  };
1712
1844
  const parsed = GateConfigSchema.safeParse(merged);
@@ -2999,6 +3131,41 @@ function classifyLabel(raw, consentContext = false) {
2999
3131
  if (SETTINGS_LABEL.test(t)) return { role: "settings", score: 60 };
3000
3132
  return null;
3001
3133
  }
3134
+ var BANNER_MARK_SOURCE = "cookie|consent|(?:^|[^a-z])cmp(?:[^a-z]|$)|gdpr|dsgvo|onetrust|cookiebot|cybot|usercentrics|didomi|borlabs|klaro|iubenda|sp[-_]message|cookielaw|cc[-_]?(?:window|banner)|privacy[-_]?(?:banner|notice|popup|dialog|bar)|datenschutz[-_]?(?:banner|hinweis|leiste)";
3135
+ var BANNER_TOKENS = [
3136
+ "cookie",
3137
+ "consent",
3138
+ "cmp",
3139
+ "onetrust",
3140
+ "privacy",
3141
+ "didomi",
3142
+ "usercentrics",
3143
+ "iubenda",
3144
+ "gdpr",
3145
+ "dsgvo",
3146
+ "borlabs",
3147
+ "klaro",
3148
+ "cookiebot",
3149
+ "cybot",
3150
+ "cookielaw",
3151
+ "cc-window",
3152
+ "cc-banner",
3153
+ "sp_message",
3154
+ "sp-message",
3155
+ "datenschutz"
3156
+ ];
3157
+ var BANNER_MARKED_SELECTOR = "[role=dialog],[role=alertdialog],[aria-modal=true],dialog," + BANNER_TOKENS.flatMap((t) => [`[id*=${t} i]`, `[class*=${t} i]`]).join(",");
3158
+ var CLOSE_GLYPHS = "\xD7\u2715\u2716\u2717\u2718\u274C\u2A2F\u2573xX";
3159
+ var CLOSE_LABEL_SOURCE = `^(?:[${CLOSE_GLYPHS}]|.*\\b(?:close|schlie(?:ss|\xDF)en|ausblenden|fermer|chiudi|dismiss)\\b.*)$`;
3160
+ var AGREE_LABEL_SOURCE = "einverstanden|akzept|zustimm|accept|agree|allow|erlaub|verstanden|got it|\\bok\\b|okay|einstellung|setting|anpass|verwalt|customi|ablehn|reject|decline|refus|notwendig|necessary|speicher|\\bsave\\b";
3161
+ var CLOSE_CLASS_SELECTOR = "[class*=close i],[id*=close i],[aria-label*=close i],[aria-label*=schlie i],[title*=close i],[title*=schlie i],[class*=dismiss i]";
3162
+ var CLOSE_LABEL_RE = new RegExp(CLOSE_LABEL_SOURCE, "i");
3163
+ var AGREE_LABEL_RE = new RegExp(AGREE_LABEL_SOURCE, "i");
3164
+ function isCloseLabel(label) {
3165
+ const l = label.replace(/\uFE0F/g, "").replace(/\s+/g, " ").trim();
3166
+ if (!l || AGREE_LABEL_RE.test(l)) return false;
3167
+ return CLOSE_LABEL_RE.test(l);
3168
+ }
3002
3169
  var INFO_LINK = word(
3003
3170
  [
3004
3171
  "datenschutz\\p{L}*",
@@ -3029,6 +3196,7 @@ var INFO_LINK = word(
3029
3196
  ].join("|")
3030
3197
  );
3031
3198
  function classifyControl(label, consentContext = true) {
3199
+ if (isCloseLabel(label)) return "close";
3032
3200
  const m = classifyLabel(label, consentContext);
3033
3201
  if (m) return m.role;
3034
3202
  return INFO_LINK.test(normalizeLabel(label)) ? "info" : "unknown";
@@ -3162,10 +3330,16 @@ var BANNER_CONTAINER = "[role=dialog], [role=alertdialog], [aria-modal=true], di
3162
3330
  async function inSameBanner(anchor, other) {
3163
3331
  if (anchor.frame !== other.frame) return false;
3164
3332
  if (anchor.frame.parentFrame()) return true;
3165
- const a = anchor.handle;
3166
3333
  const b = await targetLocator(other).elementHandle({ timeout: 1e3 }).catch(() => null);
3167
- if (!a || !b) return false;
3168
- const same = await a.evaluate(
3334
+ if (!b) return false;
3335
+ const same = await sameBannerHandles(anchor.handle, b);
3336
+ await b.dispose().catch(() => {
3337
+ });
3338
+ return same;
3339
+ }
3340
+ async function sameBannerHandles(a, b) {
3341
+ if (!a) return false;
3342
+ return a.evaluate(
3169
3343
  (el, [otherEl, selector]) => {
3170
3344
  let root = el.closest(selector);
3171
3345
  while (root && root !== document.body && root !== document.documentElement) {
@@ -3176,9 +3350,6 @@ async function inSameBanner(anchor, other) {
3176
3350
  },
3177
3351
  [b, BANNER_CONTAINER]
3178
3352
  ).catch(() => false);
3179
- await b.dispose().catch(() => {
3180
- });
3181
- return same;
3182
3353
  }
3183
3354
  var TOGGLE_SELECTOR = "input[type=checkbox], [role=switch], [role=checkbox]";
3184
3355
  var CATEGORY_WORDS = /statisti|analyti|analys|marketing|werbung|werbe|advertis|targeting|personali|performance|leistung|funktional|functional|komfort|präferenz|preference|tracking|social|soziale|measurement|messung|mesure|publicit|pubblicit|statistich|profil|audience|reichweite|vendor|anbieter|partner|zweck|purpose|finalit|cookies?/i;
@@ -3312,7 +3483,18 @@ var scanButtons = (arg) => {
3312
3483
  chosen.el.setAttribute("data-cpcg-pick", arg.role || "x");
3313
3484
  return true;
3314
3485
  }
3486
+ const up = (start) => {
3487
+ const out = [];
3488
+ let n = start;
3489
+ for (let d = 0; d < 60 && n; d++) {
3490
+ out.push(n);
3491
+ n = n.parentElement ?? (n.getRootNode().host ?? null);
3492
+ }
3493
+ return out;
3494
+ };
3495
+ const anchorBoxes = arg.near ? up(arg.near).filter((e) => e !== document.body && e !== document.documentElement && e.matches(BOX)) : [];
3315
3496
  return visible.map((v, i) => {
3497
+ const near = anchorBoxes.length > 0 && up(v.el).some((e) => anchorBoxes.includes(e));
3316
3498
  let node = v.el;
3317
3499
  let box = null;
3318
3500
  let hit = false;
@@ -3331,26 +3513,144 @@ var scanButtons = (arg) => {
3331
3513
  }
3332
3514
  hit = CTX.test((container.textContent || "").slice(0, 3e3));
3333
3515
  }
3334
- return { i, text: v.text, ctx: hit };
3516
+ return { i, text: v.text, ctx: hit, near };
3335
3517
  });
3336
3518
  };
3337
- async function pickSemantic(frame, role) {
3338
- const list = await boundedFrameQuery(frame, frame.evaluate(scanButtons, { mode: "list" })).catch(() => null);
3339
- if (!list?.length) return null;
3340
- let best = null;
3519
+ async function semanticCandidates(frame, role, near) {
3520
+ let list;
3521
+ try {
3522
+ list = await boundedFrameQuery(frame, frame.evaluate(scanButtons, { mode: "list", near: near ?? null }));
3523
+ } catch (err) {
3524
+ if (err instanceof FrameQueryTimeout) return null;
3525
+ return [];
3526
+ }
3527
+ if (!list?.length) return [];
3528
+ const scored = [];
3341
3529
  for (const c of list) {
3342
3530
  const m = classifyLabel(c.text, c.ctx);
3343
3531
  if (m?.role !== role) continue;
3344
- const score = m.score + (c.ctx ? 10 : 0);
3345
- if (!best || score > best.score) best = { c, score };
3532
+ scored.push({ c, score: m.score + (c.ctx ? 10 : 0) });
3346
3533
  }
3347
- if (!best) return null;
3534
+ return scored.sort((a, b) => Number(!!b.c.near) - Number(!!a.c.near) || b.score - a.score).map((x) => x.c);
3535
+ }
3536
+ async function pickCandidate(frame, role, c) {
3348
3537
  const picked = await boundedFrameQuery(
3349
3538
  frame,
3350
- frame.evaluate(scanButtons, { mode: "pick", index: best.c.i, text: best.c.text, role })
3539
+ frame.evaluate(scanButtons, { mode: "pick", index: c.i, text: c.text, role })
3351
3540
  ).catch(() => false);
3352
3541
  if (!picked) return null;
3353
- return { frame, selector: `[data-cpcg-pick="${role}"]`, via: `${SEMANTIC_PREFIX}${role}`, label: best.c.text };
3542
+ return { frame, selector: `[data-cpcg-pick="${role}"]`, via: `${SEMANTIC_PREFIX}${role}`, label: c.text };
3543
+ }
3544
+ async function pickSemantic(frame, role) {
3545
+ const [best] = await semanticCandidates(frame, role) ?? [];
3546
+ return best ? pickCandidate(frame, role, best) : null;
3547
+ }
3548
+ var pickCounter = 0;
3549
+ var SAME_BANNER_CANDIDATES = 8;
3550
+ async function findInSameBanner(page, selectors, anchor, _opts = {}) {
3551
+ const skipped = [];
3552
+ const frame = anchor.frame;
3553
+ if (frame.isDetached()) return { target: null, skipped };
3554
+ const inIframe = !!frame.parentFrame();
3555
+ for (const selector of selectors) {
3556
+ if (isSemantic(selector)) {
3557
+ const role = selector.slice(SEMANTIC_PREFIX.length);
3558
+ const candidates = await semanticCandidates(frame, role, anchor.handle);
3559
+ if (candidates === null) return { target: null, skipped };
3560
+ for (const c of candidates.slice(0, SAME_BANNER_CANDIDATES)) {
3561
+ const t = await pickCandidate(frame, role, c);
3562
+ if (!t) continue;
3563
+ if (await inSameBanner(anchor, t)) return { target: t, skipped };
3564
+ skipped.push(c.text);
3565
+ }
3566
+ continue;
3567
+ }
3568
+ let handles;
3569
+ try {
3570
+ handles = await boundedFrameQuery(frame, frame.locator(selector).filter({ visible: true }).elementHandles());
3571
+ } catch (err) {
3572
+ if (err instanceof FrameQueryTimeout) return { target: null, skipped };
3573
+ continue;
3574
+ }
3575
+ try {
3576
+ for (const h of handles.slice(0, SAME_BANNER_CANDIDATES)) {
3577
+ const label = await boundedFrameQuery(
3578
+ frame,
3579
+ h.evaluate((node) => {
3580
+ const el = node;
3581
+ return (el.innerText || el.getAttribute("aria-label") || "").replace(/\s+/g, " ").trim().slice(0, 60);
3582
+ })
3583
+ ).catch(() => null);
3584
+ if (label === null) continue;
3585
+ if (inIframe || await sameBannerHandles(anchor.handle, h)) {
3586
+ const id = `pick-${++pickCounter}`;
3587
+ const marked = await boundedFrameQuery(
3588
+ frame,
3589
+ h.evaluate((node, mark) => {
3590
+ node.setAttribute("data-cpcg-pick", mark);
3591
+ return true;
3592
+ }, id)
3593
+ ).catch(() => false);
3594
+ if (!marked) continue;
3595
+ return { target: { frame, selector: `[data-cpcg-pick="${id}"]`, via: selector, label: label || void 0 }, skipped };
3596
+ }
3597
+ skipped.push(label || selector);
3598
+ }
3599
+ } finally {
3600
+ await Promise.all(handles.map((x) => x.dispose().catch(() => void 0)));
3601
+ }
3602
+ }
3603
+ return { target: null, skipped };
3604
+ }
3605
+ async function findCloseNear(anchor) {
3606
+ const handle = await targetLocator(anchor).elementHandle({ timeout: 1500 }).catch(() => null);
3607
+ if (!handle) return null;
3608
+ const id = `close-${++pickCounter}`;
3609
+ const found = await boundedFrameQuery(
3610
+ anchor.frame,
3611
+ handle.evaluate(
3612
+ (el, a) => {
3613
+ const CLOSE = new RegExp(a.close, "i");
3614
+ const AGREE = new RegExp(a.agree, "i");
3615
+ const visible = (e) => {
3616
+ const r = e.getBoundingClientRect();
3617
+ const st = getComputedStyle(e);
3618
+ return r.width > 0 && r.height > 0 && st.visibility !== "hidden" && st.display !== "none";
3619
+ };
3620
+ const labelOf = (e) => (e.innerText || e.getAttribute("aria-label") || e.getAttribute("title") || "").replace(/️/g, "").replace(/\s+/g, " ").trim();
3621
+ let n = el;
3622
+ for (let d = 0; d < 60 && n; d++) {
3623
+ if (n !== document.body && n !== document.documentElement && n.matches(a.container)) {
3624
+ const roots = [n, ...n.shadowRoot ? [n.shadowRoot] : []];
3625
+ for (const root of roots) {
3626
+ for (const c of Array.from(root.querySelectorAll(`${a.cand}, ${a.closeSel}`))) {
3627
+ if (c === el || !visible(c)) continue;
3628
+ const label = labelOf(c);
3629
+ if (AGREE.test(label)) continue;
3630
+ if (CLOSE.test(label) || c.matches(a.closeSel)) {
3631
+ c.setAttribute("data-cpcg-pick", a.id);
3632
+ return true;
3633
+ }
3634
+ }
3635
+ }
3636
+ }
3637
+ n = n.parentElement ?? (n.getRootNode().host ?? null);
3638
+ }
3639
+ return false;
3640
+ },
3641
+ {
3642
+ container: BANNER_CONTAINER,
3643
+ cand: "button, a, [role=button], [tabindex]",
3644
+ closeSel: CLOSE_CLASS_SELECTOR,
3645
+ close: CLOSE_LABEL_SOURCE,
3646
+ agree: AGREE_LABEL_SOURCE,
3647
+ id
3648
+ }
3649
+ )
3650
+ ).catch(() => false);
3651
+ await handle.dispose().catch(() => {
3652
+ });
3653
+ return found ? { frame: anchor.frame, selector: `[data-cpcg-pick="${id}"]`, via: "close", label: "Schliessen" } : null;
3354
3654
  }
3355
3655
  async function findInFrame(frame, selectors) {
3356
3656
  const plain = selectors.filter((s) => !isSemantic(s));
@@ -3406,12 +3706,13 @@ async function findTarget(page, selectors, opts = {}) {
3406
3706
  }
3407
3707
  return null;
3408
3708
  }
3409
- var scanBannerHint = () => {
3410
- const MARK = /cookie|consent|(?:^|[^a-z])cmp(?:[^a-z]|$)|gdpr|dsgvo|onetrust|cookiebot|usercentrics|didomi|borlabs|klaro|iubenda|sp[-_]message|cookielaw|cc[-_]?(?:window|banner)|privacy[-_]?(?:banner|notice|popup|dialog|bar)|datenschutz[-_]?(?:banner|hinweis|leiste)/i;
3709
+ var scanBannerHint = (arg) => {
3710
+ const MARK = new RegExp(arg.mark, "i");
3711
+ const CROSS = new RegExp(`^[${arg.closeGlyphs}]$`);
3411
3712
  const WEAK = /cookie|consent|einwilligung|tracking|datenschutz|privacy|gdpr|dsgvo/i;
3412
3713
  const STRONG = /cookie|consent|einwilligung|tracking|\bcmp\b|gdpr|dsgvo/i;
3413
3714
  const CAND = "button, a, [role=button], input[type=button], input[type=submit], input[type=checkbox], [onclick], [tabindex], summary";
3414
- const CLOSE = "[class*=close i],[id*=close i],[aria-label*=close i],[aria-label*=schlie i],[title*=close i],[title*=schlie i],[class*=dismiss i]";
3715
+ const CLOSE = arg.closeSel;
3415
3716
  const SKIP = /^(HTML|HEAD|BODY|SCRIPT|STYLE|LINK|META|NOSCRIPT|A|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|SVG|IMG|OPTION|TEMPLATE)$/;
3416
3717
  const visible = (el) => {
3417
3718
  const rect = el.getBoundingClientRect();
@@ -3444,7 +3745,7 @@ var scanBannerHint = () => {
3444
3745
  if (!(marked ? WEAK : STRONG).test(text)) continue;
3445
3746
  if (!modal && !el.querySelector(CAND)) {
3446
3747
  const pos = getComputedStyle(el).position;
3447
- const cross = !!el.querySelector(CLOSE) || Array.from(el.querySelectorAll("*")).some((c) => c.children.length === 0 && /^[×✕✖xX]$/.test((c.textContent || "").trim()));
3748
+ const cross = !!el.querySelector(CLOSE) || Array.from(el.querySelectorAll("*")).some((c) => c.children.length === 0 && CROSS.test((c.textContent || "").replace(/\uFE0F/g, "").trim()));
3448
3749
  if (!(marked && (pos === "fixed" || pos === "sticky" || cross))) continue;
3449
3750
  }
3450
3751
  return true;
@@ -3499,18 +3800,19 @@ async function detectBannerHints(page) {
3499
3800
  for (const frame of page.frames()) {
3500
3801
  if (frame.isDetached()) continue;
3501
3802
  if (frame.parentFrame() && CMP_FRAME.test(frame.url()) && await frameShown(frame)) return true;
3502
- if (await boundedFrameQuery(frame, frame.evaluate(scanBannerHint)).catch(() => false) && await frameShown(frame)) return true;
3803
+ if (await boundedFrameQuery(frame, frame.evaluate(scanBannerHint, { mark: BANNER_MARK_SOURCE, closeGlyphs: CLOSE_GLYPHS, closeSel: CLOSE_CLASS_SELECTOR })).catch(() => false) && await frameShown(frame)) return true;
3503
3804
  }
3504
3805
  return false;
3505
3806
  }
3506
3807
  var NO_CHOICE = { found: false, infoOnly: false, other: [], info: [], hasClose: false, text: "" };
3507
- var probeBannerChoice = () => {
3508
- const MARK = /cookie|consent|(?:^|[^a-z])cmp(?:[^a-z]|$)|gdpr|dsgvo|onetrust|cookiebot|usercentrics|didomi|borlabs|klaro|iubenda|sp[-_]message|cookielaw|cc[-_]?(?:window|banner)|privacy[-_]?(?:banner|notice|popup|dialog|bar)|datenschutz[-_]?(?:banner|hinweis|leiste)/i;
3808
+ var probeBannerChoice = (arg) => {
3809
+ const MARK = new RegExp(arg.mark, "i");
3509
3810
  const WEAK = /cookie|consent|einwilligung|tracking|datenschutz|privacy|gdpr|dsgvo/i;
3510
3811
  const STRONG = /cookie|consent|einwilligung|tracking|\bcmp\b|gdpr|dsgvo/i;
3511
3812
  const CAND = "button, a, [role=button], input, select, textarea, [onclick], summary, label";
3512
- const CLOSE_SEL = "[class*=close i],[id*=close i],[aria-label*=close i],[aria-label*=schlie i],[title*=close i],[title*=schlie i],[class*=dismiss i]";
3513
- const CLOSE_LABEL = /^(×|✕|✖|x|close|schlie(?:ss|ß)en|fermer|chiudi|dismiss|banner schliessen)$/i;
3813
+ const CLOSE_SEL = arg.closeSel;
3814
+ const CLOSE_LABEL = new RegExp(arg.closeLabel, "i");
3815
+ const AGREE_LABEL = new RegExp(arg.agreeLabel, "i");
3514
3816
  const INFO_LABEL = /mehr (?:erfahren|informationen|infos)|weitere (?:informationen|infos)|datenschutz|cookie[- ]?(?:richtlinie|policy|erkl[aä]rung|hinweis|informationen)|privacy|learn more|more info|details|impressum|en savoir plus|maggiori informazioni|ulteriori informazioni/i;
3515
3817
  const SKIP = /^(HTML|HEAD|BODY|SCRIPT|STYLE|LINK|META|NOSCRIPT|A|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|SVG|IMG|OPTION|TEMPLATE)$/;
3516
3818
  const visible = (el) => {
@@ -3520,7 +3822,7 @@ var probeBannerChoice = () => {
3520
3822
  return style.visibility !== "hidden" && style.display !== "none" && parseFloat(style.opacity || "1") >= 0.05;
3521
3823
  };
3522
3824
  const labelOf = (el) => (el.innerText || el.value || "").replace(/\s+/g, " ").trim() || (el.getAttribute("aria-label") || el.getAttribute("title") || "").trim();
3523
- const MARKED_SEL = "[role=dialog],[role=alertdialog],[aria-modal=true],dialog,[id*=cookie i],[class*=cookie i],[id*=consent i],[class*=consent i],[id*=cmp i],[class*=cmp i],[id*=onetrust i],[class*=onetrust i],[id*=privacy i],[class*=privacy i],[id*=didomi i],[id*=usercentrics i],[id*=iubenda i],[id*=gdpr i],[class*=gdpr i],[id*=dsgvo i],[class*=dsgvo i],[id*=borlabs i],[class*=borlabs i],[id*=klaro i],[class*=klaro i],[id*=cookiebot i],[id*=cybot i],[id*=cookielaw i],[class*=cookielaw i]";
3825
+ const MARKED_SEL = arg.markedSel;
3524
3826
  let container = null;
3525
3827
  for (const el of Array.from(document.querySelectorAll(MARKED_SEL))) {
3526
3828
  if (SKIP.test(el.tagName.toUpperCase())) continue;
@@ -3561,8 +3863,10 @@ var probeBannerChoice = () => {
3561
3863
  if (all.some((o) => o !== el && o.contains(el) && !(o.tagName === "LABEL"))) continue;
3562
3864
  seen.add(el);
3563
3865
  const label = labelOf(el);
3564
- const closeLike = el.matches(CLOSE_SEL) || CLOSE_LABEL.test(label);
3565
- if (closeLike && (label.length <= 24 || el.matches(CLOSE_SEL))) {
3866
+ const plainLabel = label.replace(/\uFE0F/g, "").trim();
3867
+ const agrees = AGREE_LABEL.test(plainLabel);
3868
+ const closeLike = !agrees && (CLOSE_LABEL.test(plainLabel) || el.matches(CLOSE_SEL));
3869
+ if (closeLike) {
3566
3870
  hasClose = true;
3567
3871
  continue;
3568
3872
  }
@@ -3578,7 +3882,13 @@ var probeBannerChoice = () => {
3578
3882
  async function describeBannerChoice(page) {
3579
3883
  for (const frame of page.frames()) {
3580
3884
  if (frame.isDetached() || frame.parentFrame()) continue;
3581
- const r = await boundedFrameQuery(frame, frame.evaluate(probeBannerChoice)).catch(() => void 0);
3885
+ const r = await boundedFrameQuery(frame, frame.evaluate(probeBannerChoice, {
3886
+ mark: BANNER_MARK_SOURCE,
3887
+ markedSel: BANNER_MARKED_SELECTOR,
3888
+ closeLabel: CLOSE_LABEL_SOURCE,
3889
+ agreeLabel: AGREE_LABEL_SOURCE,
3890
+ closeSel: CLOSE_CLASS_SELECTOR
3891
+ })).catch(() => void 0);
3582
3892
  if (r?.found) {
3583
3893
  return { found: true, infoOnly: r.other.length === 0, other: r.other, info: r.info, hasClose: r.hasClose, text: r.text };
3584
3894
  }
@@ -4120,6 +4430,10 @@ var ChaosScanner = class {
4120
4430
  frameQueryTimeouts = 0;
4121
4431
  /** User-Agent der Scan-Kontexte (für den Report). */
4122
4432
  userAgent;
4433
+ /** Besucherprofil des laufenden Scans (Sprache, Zeitzone) und was davon im Bericht steht. */
4434
+ visitorProfile = VISITOR_PROFILES.ch;
4435
+ visitorInfo;
4436
+ ipCountryUrl;
4123
4437
  /**
4124
4438
  * Abgebrochene Schritte, die auch nach dem Schliessen ihrer Kontexte nicht endeten. `scan()` kehrt erst zurück, wenn
4125
4439
  * sie nach dem Schliessen des Browsers ausgelaufen sind: sonst könnten sie in einen späteren Lauf derselben Instanz
@@ -4176,6 +4490,7 @@ var ChaosScanner = class {
4176
4490
  this.cnameResolver = options.cnameResolver;
4177
4491
  this.sitemapFetcher = options.sitemapFetcher;
4178
4492
  this.onProgress = options.onProgress;
4493
+ this.ipCountryUrl = options.ipCountryUrl ?? IP_COUNTRY_URL;
4179
4494
  this.overrides = {
4180
4495
  acceptSelectors: options.acceptSelectors,
4181
4496
  rejectSelectors: options.rejectSelectors,
@@ -4225,6 +4540,15 @@ var ChaosScanner = class {
4225
4540
  this.maxSubpages = config.maxSubpages ?? 12;
4226
4541
  this.bannerProbe = "none";
4227
4542
  this.frameQueryTimeouts = 0;
4543
+ this.visitorProfile = VISITOR_PROFILES[config.visitor ?? "ch"];
4544
+ this.visitorInfo = {
4545
+ profile: this.visitorProfile.name,
4546
+ locale: this.visitorProfile.locale,
4547
+ timezoneId: this.visitorProfile.timezoneId,
4548
+ ...config.proxy ? { proxy: redactProxy(config.proxy) } : {}
4549
+ };
4550
+ const proxySetting = config.proxy ? parseProxy(config.proxy) : void 0;
4551
+ if (proxySetting && !proxySetting.ok) throw new Error(`--proxy: ${proxySetting.reason}`);
4228
4552
  this.bannerIssue = void 0;
4229
4553
  this.botProtection = void 0;
4230
4554
  this.challengeUnsolved = false;
@@ -4288,6 +4612,7 @@ var ChaosScanner = class {
4288
4612
  }
4289
4613
  browser = await launchScanBrowser({
4290
4614
  headless: config.headless,
4615
+ ...proxySetting?.ok ? { proxy: proxySetting.proxy } : {},
4291
4616
  // Mit Freigabe-Headern liefert der Scanner Dokumente der eigenen Origin selbst aus (route.fetch/fulfill). Chrome
4292
4617
  // kennt dann deren Netzadresse nicht und blockiert Anfragen ins lokale/private Netz (Local Network Access), die
4293
4618
  // die Seite sonst normal laden würde (Staging im internen Netz). Nur in diesem Fall abgeschaltet.
@@ -4300,6 +4625,9 @@ var ChaosScanner = class {
4300
4625
  this.browserVersion = `chromium ${browser.version()}`;
4301
4626
  this.userAgent = browserUserAgent(browser.version());
4302
4627
  const scanBrowser = browser;
4628
+ if (config.visitor === "eu" || config.proxy) {
4629
+ await this.boundedStep("Messung IP-Land", preStepDeadlineMs(config), () => this.measureIpCountry(scanBrowser, config));
4630
+ }
4303
4631
  await this.boundedStep("Pr\xFCfung der eigenen Selektoren", preStepDeadlineMs(config), () => this.checkOverrideSelectors(scanBrowser));
4304
4632
  await this.boundedStep(
4305
4633
  "Vorpr\xFCfung Google Consent Mode",
@@ -4741,8 +5069,8 @@ var ChaosScanner = class {
4741
5069
  });
4742
5070
  }
4743
5071
  await this.drainAbandoned();
4744
- if (this.targetHeaders && this.harFiles.length) {
4745
- const names = Object.keys(this.targetHeaders);
5072
+ if (this.harFiles.length) {
5073
+ const names = [...Object.keys(this.targetHeaders ?? {}), "proxy-authorization"];
4746
5074
  for (const file of this.harFiles) await redactHarHeaders(file, names);
4747
5075
  }
4748
5076
  }
@@ -4760,6 +5088,7 @@ var ChaosScanner = class {
4760
5088
  scannedAt: (/* @__PURE__ */ new Date()).toISOString(),
4761
5089
  ...this.browserVersion ? { browserVersion: this.browserVersion } : {},
4762
5090
  ...this.userAgent ? { browserUserAgent: this.userAgent } : {},
5091
+ ...this.visitorInfo ? { visitor: this.visitorInfo } : {},
4763
5092
  ...this.harFiles.length ? {
4764
5093
  harFiles: this.harFiles.map(
4765
5094
  (f) => path3.relative(path3.dirname(path3.resolve(config.reportOutput)), f).split(path3.sep).join("/")
@@ -5005,12 +5334,45 @@ var ChaosScanner = class {
5005
5334
  `${this.frameQueryTimeouts} Abfrage(n) an Seiten-Frames blieben ohne Antwort (je ${FRAME_QUERY_MS / 1e3} s).` + (unknown ? " Ob die Seite einen Banner hat, ist damit nicht belegt (kein \xABkein Banner\xBB)." : "")
5006
5335
  );
5007
5336
  }
5008
- async newContext(browser, options = {}) {
5009
- const harPath = this.harDir ? path3.join(this.harDir, `context-${String(++this.harCount).padStart(3, "0")}.har`) : void 0;
5337
+ /**
5338
+ * Land der IP, über die der Browser ins Netz geht (über den Proxy, falls gesetzt). Passt es nicht zum Profil, sieht
5339
+ * die Seite einen Besucher aus diesem Land, nicht aus dem Profil: deutliche Warnung, das Ergebnis bleibt gültig.
5340
+ */
5341
+ async measureIpCountry(browser, config) {
5342
+ const context = await this.newContext(browser, {}, { har: false });
5343
+ let country;
5344
+ try {
5345
+ const page = await context.newPage();
5346
+ const res = await page.goto(this.ipCountryUrl, { waitUntil: "domcontentloaded", timeout: Math.min(config.timeoutMs, 15e3) });
5347
+ country = parseTraceCountry(await res?.text().catch(() => "") ?? "");
5348
+ } catch {
5349
+ country = void 0;
5350
+ } finally {
5351
+ await context.close().catch(() => {
5352
+ });
5353
+ }
5354
+ const matches = ipCountryMatches(this.visitorProfile, country);
5355
+ this.visitorInfo = { ...this.visitorInfo, ...country ? { ipCountry: country, ipCountryMatches: matches } : {} };
5356
+ const label = this.visitorProfile.label;
5357
+ if (!country) {
5358
+ this.warnings.push(`Besucherprofil ${label}: Land der IP nicht ermittelbar; ob die Seite einen Besucher aus ${label} sah, ist nicht belegt.`);
5359
+ } else if (country === TOR_COUNTRY) {
5360
+ this.warnings.push(
5361
+ `Besucherprofil ${label}: der Ausgang ist das Tor-Netz (Cloudflare weist \xABT1\xBB statt eines Landes aus). Seiten sehen je nach Geo-Dienst das Land des Tor-Ausgangs oder \xABTor\xBB; viele sperren Tor (Bot-Schutz). F\xFCr belastbare L\xE4nder-Vergleiche einen Proxy mit festem Land nutzen.`
5362
+ );
5363
+ } else if (matches === false) {
5364
+ this.warnings.push(
5365
+ `Besucherprofil ${label}, aber IP-Land ${country}: Seiten, die nach IP-Adresse entscheiden, zeigen den Banner f\xFCr ${country}. Sprache und Zeitzone sind ${label}; f\xFCr echte Besucher aus ${label} --proxy mit Ausgang dort setzen.`
5366
+ );
5367
+ }
5368
+ }
5369
+ async newContext(browser, options = {}, opts = {}) {
5370
+ const harPath = this.harDir && opts.har !== false ? path3.join(this.harDir, `context-${String(++this.harCount).padStart(3, "0")}.har`) : void 0;
5010
5371
  if (harPath) this.harFiles.push(harPath);
5011
5372
  const har = harPath ? { recordHar: { path: harPath, content: "omit" } } : {};
5012
5373
  const userAgent = options.userAgent ?? this.userAgent ?? browserUserAgent(browser.version());
5013
- const context = await browser.newContext({ serviceWorkers: "block", ...har, ...userAgent ? { userAgent } : {}, ...options });
5374
+ const visitor = { locale: this.visitorProfile.locale, timezoneId: this.visitorProfile.timezoneId };
5375
+ const context = await browser.newContext({ serviceWorkers: "block", ...har, ...visitor, ...userAgent ? { userAgent } : {}, ...options });
5014
5376
  this.liveContexts.add(context);
5015
5377
  context.once("close", () => this.liveContexts.delete(context));
5016
5378
  onFrameQueryTimeout(context, () => {
@@ -5547,6 +5909,34 @@ var ChaosScanner = class {
5547
5909
  await probeContext.close().catch(() => {
5548
5910
  });
5549
5911
  }
5912
+ },
5913
+ probeClose: async () => {
5914
+ const probeContext = await this.newContext(browser);
5915
+ try {
5916
+ const probePage = await probeContext.newPage();
5917
+ watchScope(probePage, scope);
5918
+ await this.gotoTarget(probePage, _config, scope, "domcontentloaded", { probe: true });
5919
+ const acc = await findTarget(probePage, this.session.accept, { frameHint: this.session.frameHint });
5920
+ const close = acc ? await findCloseNear(acc) : null;
5921
+ if (!close) return { clicked: false, tracked: 0 };
5922
+ const clicked = await targetLocator(close).click({ timeout: 2e3 }).then(() => true, () => false);
5923
+ if (!clicked) return { clicked: false, tracked: 0 };
5924
+ scope.noteScannerClick();
5925
+ await probePage.waitForTimeout(1200);
5926
+ let tracked = 0;
5927
+ probeContext.on("request", (req) => {
5928
+ const t = identifyTracker(req.url());
5929
+ if (t && this.trackerVerdict(t) === "violation") tracked++;
5930
+ });
5931
+ await this.gotoTarget(probePage, _config, scope, "domcontentloaded", { probe: true });
5932
+ await probePage.waitForTimeout(2500);
5933
+ return { clicked: true, tracked };
5934
+ } catch {
5935
+ return { clicked: false, tracked: 0 };
5936
+ } finally {
5937
+ await probeContext.close().catch(() => {
5938
+ });
5939
+ }
5550
5940
  }
5551
5941
  };
5552
5942
  let outcome = false;
@@ -5756,14 +6146,8 @@ var ChaosScanner = class {
5756
6146
  async rejectViaSettings(page, session, scope, accept, hooks) {
5757
6147
  const frameHint = session.frameHint;
5758
6148
  const acceptHandle = await targetLocator(accept).elementHandle({ timeout: 1500 }).catch(() => null);
5759
- const settingsHit = await findInFrame(accept.frame, session.settings).catch(() => null) ?? await findTarget(page, session.settings, { frameHint });
5760
- let settings = settingsHit && await inSameBanner({ frame: accept.frame, handle: acceptHandle }, settingsHit) ? settingsHit : null;
5761
- if (settingsHit && !settings) {
5762
- hooks.log(`settings-outside-banner:${settingsHit.label ?? settingsHit.via}`);
5763
- const vendorOnly = session.settings.filter((s) => !s.startsWith("@semantic:"));
5764
- const vendorHit = await findTarget(page, vendorOnly, { frameHint });
5765
- settings = vendorHit && await inSameBanner({ frame: accept.frame, handle: acceptHandle }, vendorHit) ? vendorHit : null;
5766
- }
6149
+ const { target: settings, skipped } = await findInSameBanner(page, session.settings, { frame: accept.frame, handle: acceptHandle }, { frameHint });
6150
+ for (const label of skipped.slice(0, 3)) hooks.log(`settings-outside-banner:${label}`);
5767
6151
  await acceptHandle?.dispose().catch(() => {
5768
6152
  });
5769
6153
  if (!settings) return { outcome: "no-settings" };
@@ -5870,7 +6254,7 @@ var ChaosScanner = class {
5870
6254
  trackerCategory: "unknown",
5871
6255
  requestUrl: config.targetUrl,
5872
6256
  method: "DOM",
5873
- description: `${this.infoOnlyBanner} Vor einer Entscheidung wurden ${before2} Tracker-Request(s) beobachtet. Messergebnis: im Banner l\xE4sst sich keine Einwilligung erteilen (relevant im Modell opt-in) und keine Ablehnung w\xE4hlen (relevant im Modell opt-out). Technischer Befund, keine Rechtsbewertung.`
6257
+ description: `${this.infoOnlyBanner} Vor einer Entscheidung wurden ${before2} Tracker-Request(s) beobachtet. Messergebnis: im Banner l\xE4sst sich keine Einwilligung erteilen (relevant im Modell opt-in) und keine Ablehnung w\xE4hlen (relevant in den Modellen mit Ablehnen-M\xF6glichkeit: Widerspruch vor Aktivierung, opt-out). Technischer Befund, keine Rechtsbewertung.`
5874
6258
  },
5875
6259
  "pre-consent"
5876
6260
  );
@@ -5915,6 +6299,25 @@ var ChaosScanner = class {
5915
6299
  ctx.reason("Ablehnen \xFCber die Einstellungen (\xABAuswahl speichern\xBB) gelang nicht \u2014 daher kein Befund");
5916
6300
  return "unknown";
5917
6301
  }
6302
+ const closes = others.filter((o) => o.kind === "close");
6303
+ let closeNote = "";
6304
+ if (closes.length > 0) {
6305
+ const closeLabel = closes[0].text;
6306
+ const probe = await ctx.probeClose();
6307
+ if (!probe.clicked) {
6308
+ ctx.reason(`Schliessen-Element (\xAB${closeLabel}\xBB) im Banner nicht bedienbar \u2014 ob es ablehnt, ist offen, daher kein Befund`);
6309
+ return "unknown";
6310
+ }
6311
+ if (probe.tracked === 0) {
6312
+ ctx.log("close-acts-as-reject");
6313
+ ctx.reason(
6314
+ `Das Schliessen-Element (\xAB${closeLabel}\xBB) wirkt wie Ablehnen: nach Schliessen und Neuladen kein Tracking (Testlauf in frischem Kontext) \u2014 daher kein Befund \xABkein Ablehnen\xBB`
6315
+ );
6316
+ return "unknown";
6317
+ }
6318
+ ctx.log(`close-not-reject(${probe.tracked})`);
6319
+ closeNote = ` Das Schliessen-Element (\xAB${closeLabel}\xBB) lehnt nicht ab: nach Schliessen und Neuladen ${probe.tracked} Tracker-Request(s) (Testlauf in frischem Kontext).`;
6320
+ }
5918
6321
  const before = nonAdvisory(captured).length;
5919
6322
  const afterAccept = before > 0 ? 0 : await ctx.probeAccept();
5920
6323
  if (before === 0 && afterAccept === 0) {
@@ -5929,12 +6332,12 @@ var ChaosScanner = class {
5929
6332
  trackerCategory: "unknown",
5930
6333
  requestUrl: config.targetUrl,
5931
6334
  method: "DOM",
5932
- description: `Kein gleichwertiges Ablehnen auf der ersten Ebene gefunden: Der Banner bietet \xAB${accept.label ?? accept.via}\xBB an, aber weder \xABAblehnen\xBB noch \xABNur notwendige\xBB (auch nicht in den Einstellungen); Tracking ist aktiv (${trackingText}). Messergebnis: im Banner l\xE4sst sich keine Ablehnung w\xE4hlen (relevant im Modell opt-out; im Modell opt-in fehlt die gleichwertige Wahl). Automatische Erkennung, technischer Befund, keine Rechtsbewertung.`
6335
+ description: `Kein Ablehnen im Banner gefunden: Der Banner bietet \xAB${accept.label ?? accept.via}\xBB an, aber kein \xABAblehnen\xBB oder \xABNur notwendige\xBB auf der ersten Ebene, ${secondLevelOpened ? "und auch die ge\xF6ffneten Einstellungen bieten keinen Ablehnen-Weg" : "und keine Einstellungen"}; Tracking ist aktiv (${trackingText}).${closeNote} Messergebnis: im Banner l\xE4sst sich keine Ablehnung w\xE4hlen (relevant in den Modellen Widerspruch vor Aktivierung und opt-out; im Modell opt-in fehlt die gleichwertige Wahl). Automatische Erkennung, technischer Befund, keine Rechtsbewertung.`
5933
6336
  },
5934
6337
  "pre-consent"
5935
6338
  );
5936
6339
  ctx.note(
5937
- "Kein gleichwertiges Ablehnen auf der ersten Ebene gefunden, obwohl Tracking aktiv ist. Automatische Erkennung, technischer Befund, keine Rechtsbewertung."
6340
+ `Kein Ablehnen im Banner gefunden (weder auf der ersten Ebene noch ${secondLevelOpened ? "in den ge\xF6ffneten Einstellungen" : "\xFCber Einstellungen, der Banner bietet keine"}), obwohl Tracking aktiv ist. Automatische Erkennung, technischer Befund, keine Rechtsbewertung.`
5938
6341
  );
5939
6342
  ctx.log("finding:no-reject-option");
5940
6343
  return "violation";
@@ -9879,6 +10282,7 @@ function buildEvidenceMarkdown(report, title = "Evidence Report", options = {})
9879
10282
  ...options.client ? [`**Kunde:** ${escapeMarkdownText(options.client)} `] : [],
9880
10283
  `**Ziel:** \`${escapeCell(report.targetUrl)}\` `,
9881
10284
  `**Scan:** ${escapeMarkdownText(report.scannedAt)} `,
10285
+ ...report.visitor ? [`**Besucherprofil:** ${escapeMarkdownText(visitorLine(report.visitor))} `] : [],
9882
10286
  `**Technisches Gate:** ${facts.gateHeadline} \xB7 ${facts.findingsText} \xB7 ${facts.gateDisclaimer}`,
9883
10287
  `**Szenarien:** ${facts.checked} gepr\xFCft, ${facts.uncheckableTotal} nicht pr\xFCfbar`,
9884
10288
  `**Rechtsr\xE4ume:** ${jurisdictionModelLabel(profiles)}` + (facts.advisory > 0 ? ` \xB7 **Hinweise:** ${facts.advisory} (nicht blockierend, siehe \xABHinweise\xBB)` : ""),
@@ -10148,7 +10552,7 @@ function buildEvidenceHtml(report, title = "Evidence Report", options = {}) {
10148
10552
  const tone = severity === "P0" ? "warn" : severity === "P1" ? "gold" : "skip";
10149
10553
  const framingText = hasPreConsentFinding ? framing : hasPostConsentFinding ? `Befund: Tracking trotz abgelehnter oder widerrufener Einwilligung. ${framing}` : `Falls ein Pre-Consent-Request beobachtet wird: ${framing} Derzeit kein solcher Befund${facts.gateState === "inconclusive" || incomplete > 0 ? " (Pr\xFCfung unvollst\xE4ndig)" : ""}.`;
10150
10554
  return `<article class="jcard">
10151
- <header><span class="sev sev-${tone}">${esc2(profile.consentModel)}</span><h3>${esc2(profile.label)}</h3></header>
10555
+ <header><span class="sev sev-${tone}">${esc2(CONSENT_MODEL_LABEL[profile.consentModel])}</span><h3>${esc2(profile.label)}</h3></header>
10152
10556
  <p class="jframe">${esc2(framingText)}</p>
10153
10557
  <p class="jfw">${profile.frameworks.map(esc2).join(" \xB7 ")}</p>
10154
10558
  </article>`;
@@ -10610,6 +11014,7 @@ ${demoBanner}
10610
11014
  ` : ""}<span>Ziel: <code>${esc2(report.targetUrl)}</code></span>
10611
11015
  <span>Scan: ${esc2(fmtTime(report.scannedAt))}</span>
10612
11016
  <span>Dauer: ${esc2(fmtDuration(report.durationMs))}</span>
11017
+ ${report.visitor ? `<span>Besucher: ${esc2(visitorLine(report.visitor))}</span>` : ""}
10613
11018
  </div>
10614
11019
  <div class="gate ${gateClass}">
10615
11020
  <span class="gtitle">${esc2(gateTitle)}</span>
@@ -10628,7 +11033,7 @@ ${demoBanner}
10628
11033
  ${warningsHtml}
10629
11034
 
10630
11035
  <h2><span class="num">02</span>Jurisdictions</h2>
10631
- <p class="sub">Dieselben technischen Fakten, je Modell eine andere Wirkung im Gate. Gezeigt wird das angewandte Modell (opt-in, opt-out, notice-only), keine Rechtsaussage.</p>
11036
+ <p class="sub">Dieselben technischen Fakten, je Modell eine andere Wirkung im Gate. Gezeigt wird das angewandte Modell (opt-in, Widerspruch vor Aktivierung, opt-out, notice-only), keine Rechtsaussage.</p>
10632
11037
  <div class="jgrid">
10633
11038
  ${jCards}
10634
11039
  </div>
@@ -11418,7 +11823,7 @@ import pc from "picocolors";
11418
11823
  import { createHash } from "crypto";
11419
11824
  import fs10 from "fs/promises";
11420
11825
  import path10 from "path";
11421
- var CPCG_VERSION = true ? "0.3.6" : "dev";
11826
+ var CPCG_VERSION = true ? "0.3.8" : "dev";
11422
11827
  function scanConfigOf(config) {
11423
11828
  return {
11424
11829
  targetUrl: config.targetUrl,
@@ -11437,6 +11842,9 @@ function scanConfigOf(config) {
11437
11842
  settingsSelectors: config.settingsSelectors ?? [],
11438
11843
  bannerFrame: config.bannerFrame ?? null,
11439
11844
  headless: config.headless,
11845
+ // Besucherprofil und Ausgang gehören zur Prüfung; der Proxy nur ohne Zugangsdaten (zwei Ausgänge = zwei Konfigurationen).
11846
+ visitor: config.visitor ?? "ch",
11847
+ proxy: config.proxy ? redactProxy(config.proxy) : null,
11440
11848
  // Nur die Namen der Freigabe-Header: die Werte sind Geheimnisse.
11441
11849
  targetHeaders: Object.keys(config.targetHeaders ?? {}).sort()
11442
11850
  };
@@ -11882,6 +12290,10 @@ var PrivacyChaosGate = class {
11882
12290
  if (config.strict) row("Strict", "true (Hinweise blockieren ebenfalls)");
11883
12291
  if (config.ignore.length > 0) row("Ignore", config.ignore.join(", "));
11884
12292
  row("Jurisdiction", config.jurisdiction);
12293
+ {
12294
+ const v = VISITOR_PROFILES[config.visitor ?? "ch"];
12295
+ row("Visitor", `${v.label} (${v.locale}, ${v.timezoneId})${config.proxy ? `, \xFCber Proxy ${redactProxy(config.proxy)}` : ", ohne Proxy (IP dieses Rechners)"}`);
12296
+ }
11885
12297
  if (config.targetHeaders) row("Target Headers", `${targetHeaderNames(config.targetHeaders).join(", ")} (Werte verborgen, nur an die Ziel-Origin)`);
11886
12298
  row("Report Output", config.reportOutput);
11887
12299
  console.log("");
@@ -12664,6 +13076,7 @@ export {
12664
13076
  JurisdictionCodeSchema,
12665
13077
  GateConfigSchema,
12666
13078
  EXIT,
13079
+ CONSENT_MODEL_LABEL,
12667
13080
  resolveJurisdictions,
12668
13081
  CORE_SCENARIOS,
12669
13082
  groupFindings,
package/dist/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ CONSENT_MODEL_LABEL,
3
4
  ENV_FILE_KEYS_HELP,
4
5
  EXIT,
5
6
  LICENSE_CONTACT,
@@ -11,12 +12,12 @@ import {
11
12
  resolveEntitlement,
12
13
  resolveGateConfig,
13
14
  resolveJurisdictions
14
- } from "./chunk-PDBLZE7N.js";
15
+ } from "./chunk-IPUQQWLQ.js";
15
16
 
16
17
  // src/cli.ts
17
18
  import { Command, CommanderError } from "commander";
18
19
  import pc from "picocolors";
19
- var VERSION = true ? "0.3.6" : "dev";
20
+ var VERSION = true ? "0.3.8" : "dev";
20
21
  for (const stream of [process.stdout, process.stderr]) {
21
22
  stream.on("error", (err) => {
22
23
  if (err.code !== "EPIPE") throw err;
@@ -49,7 +50,7 @@ Lizenz:
49
50
  `;
50
51
  var collect = (value, previous) => [...previous, value];
51
52
  var program = new Command();
52
- program.name("cpcg").description("Cuonztech Privacy Chaos Gate - CI/CD Shift-Left Consent Scanner & Auto-Remediation").version(VERSION).option("-u, --url <url>", "Staging- oder localhost-URL (http/https) \u2014 Pflicht").option("-k, --api-key <key>", "LLM-API-Key; wirkt nur mit --llm-remediation (Env-Fallback nur passend zum Provider)").option("--allow-custom-banner-fix [boolean]", "Auto-Fix darf auch bei eigenem Banner (kein erkanntes CMP) Skripte \xE4ndern. Standard aus: dann nur Anleitung (default: false)").option("--llm-remediation [boolean]", "Opt-in: Quellcode darf zur Patch-Erzeugung an den LLM-Anbieter gesendet werden (default: false)").option("-p, --llm-provider <provider>", "LLM-Provider: openai | anthropic | gemini (umgesetzt ist derzeit nur openai; sonst greift die Regel-Engine) (default: openai)").option("-m, --llm-model <model>", "LLM-Modell (default: gpt-4o)").option("--auto-fix [boolean]", "Code-Patches erzeugen und im Quellverzeichnis anwenden (default: true nur mit ausdr\xFCcklichem --source-dir, sonst false)").option("--fail-on-leak [boolean]", "Build blockieren (Exit 1), wenn Leaks bleiben (default: true)").option("--fail-on-uncheckable [boolean]", "Exit 4, wenn Kernszenarien nicht pr\xFCfbar sind; bei false Exit 0, das Ergebnis bleibt als unvollst\xE4ndig markiert (default: true)").option("-r, --report-output <path>", "Pfad des JSON-Reports (default: reports/privacy-chaos-report.json)").option("-s, --source-dir <dir>", "Quellcode-Verzeichnis f\xFCr Auto-Fix; ausdr\xFCcklich angeben, um Auto-Fix zu aktivieren").option("--git-commit [boolean]", "Fixes automatisch in den Git-Branch committen \u2014 Lizenz erforderlich (default: false)").option("--create-pr [boolean]", "Fix-Branch anlegen und GitHub-PR \xF6ffnen; hat Vorrang vor --git-commit \u2014 Lizenz erforderlich (default: false)").option("--github-token <token>", "GitHub-Token f\xFCr PR-Erstellung (besser: Env GITHUB_TOKEN)").option("--base-branch <branch>", "PR-Basisbranch (default: Default-Branch des Remotes)").option("--branch-prefix <prefix>", "Branch-Pr\xE4fix f\xFCr Fix-PRs (default: fix/cpcg-privacy)").option("--headless [boolean]", "Browser headless starten (default: true)").option("--timeout-ms <ms>", "Timeout je Szenario-Navigation und f\xFCr den Erreichbarkeits-Check in ms, positive ganze Zahl (default: 30000)").option("--strict [boolean]", "Hinweise (rein funktionale Drittanbieter wie Google Fonts) blockieren das Gate ebenfalls (default: false)").option("--ignore <liste>", "Befunde ignorieren: Tracker-Name oder Host-Muster, kommagetrennt oder mehrfach (z. B. fonts.googleapis.com,*.hotjar.com); im Report als \xABignoriert\xBB ausgewiesen; `*`/`**` und nackte TLDs (com, ch) werden immer abgelehnt (zum Abschalten der Blockierung --fail-on-leak false), ganze Zonen (*.com) ohne --allow-broad-ignore", collect, []).option("--allow-broad-ignore [boolean]", "Ganze Zonen als --ignore-Muster (*.com, *.co.uk, .ch) bewusst zulassen; sie werden in Konsole und Report als Warnung ausgewiesen; `*` und nackte TLDs bleiben abgelehnt (default: false)").option("--accept-selector <css>", "Eigener CSS-Selektor des Akzeptieren-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--reject-selector <css>", "Eigener CSS-Selektor des Ablehnen-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--settings-selector <css>", "Eigener CSS-Selektor des Einstellungen-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--banner-frame <teilstring>", "Teilstring der URL des Banner-iframes (CMP im Frame)").option("--max-subpages <n>", "Obergrenze der Unterseiten-Stichprobe (Szenario subpage-spa), ganze Zahl 1\u201340 (default: 12; Env CPCG_MAX_SUBPAGES). Bleibt die Stichprobe unvollst\xE4ndig, weist das Gate das aus (Exit-Code unver\xE4ndert)").option("--sitemap [boolean]", "Sitemap-Tiefenlauf: Unterseiten aus robots.txt/sitemap.xml und den Links der Startseite pr\xFCfen, bis --deep-budget verbraucht ist (statt --max-subpages; Env CPCG_SITEMAP)").option("--deep-budget <sekunden>", "Zeitbudget des Sitemap-Tiefenlaufs f\xFCr die Unterseiten, 30\u20133600 (default: 300; Env CPCG_DEEP_BUDGET)").option("--deep-state <pfad>", "Zustandsdatei des Tiefenlaufs: der n\xE4chste Lauf setzt bei den noch nicht gepr\xFCften Unterseiten fort (Env CPCG_DEEP_STATE)").option("--baseline <pfad>", "Report (JSON) eines fr\xFCheren Laufs: der Bericht nennt neue, weggefallene und gleich gebliebene Befunde (Env CPCG_BASELINE)").option("--har [boolean]", "HAR-Mitschnitt je Browser-Kontext ohne Inhalte nach evidence/har neben dem Report (Env CPCG_HAR); enth\xE4lt Adressen und Header der Zielseite").option("--verify-url <url>", "Geschlossener Kreis: hat die Ziel-URL Befunde, zus\xE4tzlich diese URL pr\xFCfen (z. B. Vorschau des Fix-PRs); nur ein sauberer, vollst\xE4ndiger Scan dort heisst \xABFix verifiziert\xBB (Env CPCG_VERIFY_URL)").option("--verify-wait <sekunden>", "So lange auf die Erreichbarkeit der Verify-URL warten, 0\u20131800 (default: 0; Env CPCG_VERIFY_WAIT)").option("--target-header <name: wert>", "Freigabe-Header nur f\xFCr die gepr\xFCfte Website (mehrfach), z. B. f\xFCr eine WAF-Ausnahme oder Vercel \xABx-vercel-protection-bypass: \u2026\xBB; geht nie an Drittanbieter, Werte erscheinen in keinem Report. Im CI besser \xFCber Env CPCG_TARGET_HEADERS (eine Zeile je Header)", collect, []).option("--banner-wait <sekunden>", "Wartefenster auf einen (sp\xE4t erscheinenden) Banner in Sekunden, 1\u201360 (default: 8, bei Seiten ohne Banner-Hinweis fr\xFCher beendet; mit Angabe wird das Fenster ausgesch\xF6pft, auch bei --accept-selector/--reject-selector; Env CPCG_BANNER_WAIT)").option("--license <token>", "Cuonztech CPCG Lizenzcode CPCG-\u2026 oder Kunden-Key CPCG-K-\u2026 (oder Env CPCG_LICENSE) \u2014 nach Online-Kauf per E-Mail").option(
53
+ program.name("cpcg").description("Cuonztech Privacy Chaos Gate - CI/CD Shift-Left Consent Scanner & Auto-Remediation").version(VERSION).option("-u, --url <url>", "Staging- oder localhost-URL (http/https) \u2014 Pflicht").option("-k, --api-key <key>", "LLM-API-Key; wirkt nur mit --llm-remediation (Env-Fallback nur passend zum Provider)").option("--allow-custom-banner-fix [boolean]", "Auto-Fix darf auch bei eigenem Banner (kein erkanntes CMP) Skripte \xE4ndern. Standard aus: dann nur Anleitung (default: false)").option("--llm-remediation [boolean]", "Opt-in: Quellcode darf zur Patch-Erzeugung an den LLM-Anbieter gesendet werden (default: false)").option("-p, --llm-provider <provider>", "LLM-Provider: openai | anthropic | gemini (umgesetzt ist derzeit nur openai; sonst greift die Regel-Engine) (default: openai)").option("-m, --llm-model <model>", "LLM-Modell (default: gpt-4o)").option("--auto-fix [boolean]", "Code-Patches erzeugen und im Quellverzeichnis anwenden (default: true nur mit ausdr\xFCcklichem --source-dir, sonst false)").option("--fail-on-leak [boolean]", "Build blockieren (Exit 1), wenn Leaks bleiben (default: true)").option("--fail-on-uncheckable [boolean]", "Exit 4, wenn Kernszenarien nicht pr\xFCfbar sind; bei false Exit 0, das Ergebnis bleibt als unvollst\xE4ndig markiert (default: true)").option("-r, --report-output <path>", "Pfad des JSON-Reports (default: reports/privacy-chaos-report.json)").option("-s, --source-dir <dir>", "Quellcode-Verzeichnis f\xFCr Auto-Fix; ausdr\xFCcklich angeben, um Auto-Fix zu aktivieren").option("--git-commit [boolean]", "Fixes automatisch in den Git-Branch committen \u2014 Lizenz erforderlich (default: false)").option("--create-pr [boolean]", "Fix-Branch anlegen und GitHub-PR \xF6ffnen; hat Vorrang vor --git-commit \u2014 Lizenz erforderlich (default: false)").option("--github-token <token>", "GitHub-Token f\xFCr PR-Erstellung (besser: Env GITHUB_TOKEN)").option("--base-branch <branch>", "PR-Basisbranch (default: Default-Branch des Remotes)").option("--branch-prefix <prefix>", "Branch-Pr\xE4fix f\xFCr Fix-PRs (default: fix/cpcg-privacy)").option("--headless [boolean]", "Browser headless starten (default: true)").option("--visitor <profil>", "Besucherprofil: ch (de-CH, Zeitzone Z\xFCrich) oder eu (de-DE, Berlin); feste Sprache/Zeitzone statt der des Rechners (default: ch; Env CPCG_VISITOR). Das Land der IP \xE4ndert nur --proxy").option("--proxy <url>", "Proxy f\xFCr alle Browser-Zugriffe, z. B. ein Ausgang in der EU: http(s)://[user:pass@]host:port oder socks5://host:port (Env CPCG_PROXY, nie aus .env). Das gemessene IP-Land steht im Report").option("--timeout-ms <ms>", "Timeout je Szenario-Navigation und f\xFCr den Erreichbarkeits-Check in ms, positive ganze Zahl (default: 30000)").option("--strict [boolean]", "Hinweise (rein funktionale Drittanbieter wie Google Fonts) blockieren das Gate ebenfalls (default: false)").option("--ignore <liste>", "Befunde ignorieren: Tracker-Name oder Host-Muster, kommagetrennt oder mehrfach (z. B. fonts.googleapis.com,*.hotjar.com); im Report als \xABignoriert\xBB ausgewiesen; `*`/`**` und nackte TLDs (com, ch) werden immer abgelehnt (zum Abschalten der Blockierung --fail-on-leak false), ganze Zonen (*.com) ohne --allow-broad-ignore", collect, []).option("--allow-broad-ignore [boolean]", "Ganze Zonen als --ignore-Muster (*.com, *.co.uk, .ch) bewusst zulassen; sie werden in Konsole und Report als Warnung ausgewiesen; `*` und nackte TLDs bleiben abgelehnt (default: false)").option("--accept-selector <css>", "Eigener CSS-Selektor des Akzeptieren-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--reject-selector <css>", "Eigener CSS-Selektor des Ablehnen-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--settings-selector <css>", "Eigener CSS-Selektor des Einstellungen-Buttons (mehrfach oder kommagetrennt)", collect, []).option("--banner-frame <teilstring>", "Teilstring der URL des Banner-iframes (CMP im Frame)").option("--max-subpages <n>", "Obergrenze der Unterseiten-Stichprobe (Szenario subpage-spa), ganze Zahl 1\u201340 (default: 12; Env CPCG_MAX_SUBPAGES). Bleibt die Stichprobe unvollst\xE4ndig, weist das Gate das aus (Exit-Code unver\xE4ndert)").option("--sitemap [boolean]", "Sitemap-Tiefenlauf: Unterseiten aus robots.txt/sitemap.xml und den Links der Startseite pr\xFCfen, bis --deep-budget verbraucht ist (statt --max-subpages; Env CPCG_SITEMAP)").option("--deep-budget <sekunden>", "Zeitbudget des Sitemap-Tiefenlaufs f\xFCr die Unterseiten, 30\u20133600 (default: 300; Env CPCG_DEEP_BUDGET)").option("--deep-state <pfad>", "Zustandsdatei des Tiefenlaufs: der n\xE4chste Lauf setzt bei den noch nicht gepr\xFCften Unterseiten fort (Env CPCG_DEEP_STATE)").option("--baseline <pfad>", "Report (JSON) eines fr\xFCheren Laufs: der Bericht nennt neue, weggefallene und gleich gebliebene Befunde (Env CPCG_BASELINE)").option("--har [boolean]", "HAR-Mitschnitt je Browser-Kontext ohne Inhalte nach evidence/har neben dem Report (Env CPCG_HAR); enth\xE4lt Adressen und Header der Zielseite").option("--verify-url <url>", "Geschlossener Kreis: hat die Ziel-URL Befunde, zus\xE4tzlich diese URL pr\xFCfen (z. B. Vorschau des Fix-PRs); nur ein sauberer, vollst\xE4ndiger Scan dort heisst \xABFix verifiziert\xBB (Env CPCG_VERIFY_URL)").option("--verify-wait <sekunden>", "So lange auf die Erreichbarkeit der Verify-URL warten, 0\u20131800 (default: 0; Env CPCG_VERIFY_WAIT)").option("--target-header <name: wert>", "Freigabe-Header nur f\xFCr die gepr\xFCfte Website (mehrfach), z. B. f\xFCr eine WAF-Ausnahme oder Vercel \xABx-vercel-protection-bypass: \u2026\xBB; geht nie an Drittanbieter, Werte erscheinen in keinem Report. Im CI besser \xFCber Env CPCG_TARGET_HEADERS (eine Zeile je Header)", collect, []).option("--banner-wait <sekunden>", "Wartefenster auf einen (sp\xE4t erscheinenden) Banner in Sekunden, 1\u201360 (default: 8, bei Seiten ohne Banner-Hinweis fr\xFCher beendet; mit Angabe wird das Fenster ausgesch\xF6pft, auch bei --accept-selector/--reject-selector; Env CPCG_BANNER_WAIT)").option("--license <token>", "Cuonztech CPCG Lizenzcode CPCG-\u2026 oder Kunden-Key CPCG-K-\u2026 (oder Env CPCG_LICENSE) \u2014 nach Online-Kauf per E-Mail").option(
53
54
  "--jurisdiction <code>",
54
55
  "Rechtsr\xE4ume, komma-getrennt: CH | EU | UK | US-CA | BR | ROW (default: CH,EU). Der strengste Befund je Rechtsraum gewinnt; der Report f\xFChrt alle auf."
55
56
  ).option("--report-pdf [boolean]", "Deluxe-PDF (Deckblatt + Evidence) nach dem Scan erzeugen \u2014 Lizenz erforderlich").option("--client <name>", "Kundenname f\xFCr Kundenreport und PDF-Deckblatt \u2014 Lizenz erforderlich (PDF-default: Host der Ziel-URL)").option("--demo [boolean]", "Demo-Lauf \u2014 Report wird als synthetische Testdaten gekennzeichnet").addHelpText("after", EXIT_CODES_HELP).allowExcessArguments(false).showHelpAfterError("(cpcg --help zeigt alle Optionen)").exitOverride().action(async (options) => {
@@ -94,7 +95,7 @@ program.name("cpcg").description("Cuonztech Privacy Chaos Gate - CI/CD Shift-Lef
94
95
  console.log(pc.yellow("\u26A0 LLM-API-Key gesetzt, aber --llm-remediation fehlt: Quellcode wird NICHT an einen LLM-Anbieter gesendet."));
95
96
  }
96
97
  const juris = resolveJurisdictions(config.jurisdiction);
97
- console.log(pc.blue("\u2139 Jurisdiktion: "), pc.white(juris.map((j) => `${j.label} (${j.code}, ${j.consentModel})`).join(" + ")));
98
+ console.log(pc.blue("\u2139 Jurisdiktion: "), pc.white(juris.map((j) => `${j.label} (${j.code}, ${CONSENT_MODEL_LABEL[j.consentModel]})`).join(" + ")));
98
99
  for (const j of juris) console.log(pc.dim(` ${j.frameworks.join(" \xB7 ")}`));
99
100
  const gate = new PrivacyChaosGate();
100
101
  const result = await gate.run(config);
package/dist/index.d.ts CHANGED
@@ -812,6 +812,29 @@ declare const LeakReportSchema: z.ZodObject<{
812
812
  browserVersion: z.ZodOptional<z.ZodString>;
813
813
  /** User-Agent, mit dem sich die Scan-Kontexte gemeldet haben (Chrome-Kennzeichen ohne «Headless»). */
814
814
  browserUserAgent: z.ZodOptional<z.ZodString>;
815
+ /** Besucherprofil des Laufs: Sprache, Zeitzone, Proxy (ohne Zugangsdaten) und gemessenes IP-Land. */
816
+ visitor: z.ZodOptional<z.ZodObject<{
817
+ profile: z.ZodEnum<["ch", "eu"]>;
818
+ locale: z.ZodString;
819
+ timezoneId: z.ZodString;
820
+ proxy: z.ZodOptional<z.ZodString>;
821
+ ipCountry: z.ZodOptional<z.ZodString>;
822
+ ipCountryMatches: z.ZodOptional<z.ZodBoolean>;
823
+ }, "strip", z.ZodTypeAny, {
824
+ profile: "ch" | "eu";
825
+ locale: string;
826
+ timezoneId: string;
827
+ proxy?: string | undefined;
828
+ ipCountry?: string | undefined;
829
+ ipCountryMatches?: boolean | undefined;
830
+ }, {
831
+ profile: "ch" | "eu";
832
+ locale: string;
833
+ timezoneId: string;
834
+ proxy?: string | undefined;
835
+ ipCountry?: string | undefined;
836
+ ipCountryMatches?: boolean | undefined;
837
+ }>>;
815
838
  /** `--har`: in diesem Lauf geschriebene HAR-Dateien, relativ zum Report-Ordner (eigener Unterordner je Lauf). */
816
839
  harFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
817
840
  /** Herkunft des Laufs: Version, Scan-Konfiguration ohne Geheimnisse und deren SHA-256 (`provenance.ts`). */
@@ -1135,6 +1158,14 @@ declare const LeakReportSchema: z.ZodObject<{
1135
1158
  passedScenarios: ("happy-path-denied" | "happy-path-accepted" | "fast-click" | "state-manipulation" | "network-drop" | "consent-revoked" | "category-selective" | "consent-persistence" | "banner-ignored" | "subpage-spa" | "cmp-failure" | "embed-leaks" | "consent-mode-v2" | "duplicate-events" | "mobile-usability" | "gpc-signal")[];
1136
1159
  failedScenarios: ("happy-path-denied" | "happy-path-accepted" | "fast-click" | "state-manipulation" | "network-drop" | "consent-revoked" | "category-selective" | "consent-persistence" | "banner-ignored" | "subpage-spa" | "cmp-failure" | "embed-leaks" | "consent-mode-v2" | "duplicate-events" | "mobile-usability" | "gpc-signal")[];
1137
1160
  summary: string;
1161
+ visitor?: {
1162
+ profile: "ch" | "eu";
1163
+ locale: string;
1164
+ timezoneId: string;
1165
+ proxy?: string | undefined;
1166
+ ipCountry?: string | undefined;
1167
+ ipCountryMatches?: boolean | undefined;
1168
+ } | undefined;
1138
1169
  evidence?: {
1139
1170
  targetUrl: string;
1140
1171
  status: "passed" | "suspicious" | "not-checkable" | "not-applicable";
@@ -1307,6 +1338,14 @@ declare const LeakReportSchema: z.ZodObject<{
1307
1338
  passedScenarios: ("happy-path-denied" | "happy-path-accepted" | "fast-click" | "state-manipulation" | "network-drop" | "consent-revoked" | "category-selective" | "consent-persistence" | "banner-ignored" | "subpage-spa" | "cmp-failure" | "embed-leaks" | "consent-mode-v2" | "duplicate-events" | "mobile-usability" | "gpc-signal")[];
1308
1339
  failedScenarios: ("happy-path-denied" | "happy-path-accepted" | "fast-click" | "state-manipulation" | "network-drop" | "consent-revoked" | "category-selective" | "consent-persistence" | "banner-ignored" | "subpage-spa" | "cmp-failure" | "embed-leaks" | "consent-mode-v2" | "duplicate-events" | "mobile-usability" | "gpc-signal")[];
1309
1340
  summary: string;
1341
+ visitor?: {
1342
+ profile: "ch" | "eu";
1343
+ locale: string;
1344
+ timezoneId: string;
1345
+ proxy?: string | undefined;
1346
+ ipCountry?: string | undefined;
1347
+ ipCountryMatches?: boolean | undefined;
1348
+ } | undefined;
1310
1349
  evidence?: {
1311
1350
  targetUrl: string;
1312
1351
  status: "passed" | "suspicious" | "not-checkable" | "not-applicable";
@@ -1933,6 +1972,13 @@ declare const GateConfigSchema: z.ZodObject<{
1933
1972
  * bisherige Verhalten (8 s, bei Seiten ohne Banner-Hinweis früher beendet); mit Angabe wird das Fenster ausgeschöpft.
1934
1973
  */
1935
1974
  bannerWaitSeconds: z.ZodOptional<z.ZodNumber>;
1975
+ /**
1976
+ * Besucherprofil (`--visitor`): feste Sprache und Zeitzone des Browsers (ch: de-CH/Zürich, eu: de-DE/Berlin), damit
1977
+ * der Lauf nicht von der Maschine abhängt. Das Land der IP bestimmt nur `proxy`.
1978
+ */
1979
+ visitor: z.ZodDefault<z.ZodEnum<["ch", "eu"]>>;
1980
+ /** Proxy für alle Browser-Zugriffe (`--proxy`, Env `CPCG_PROXY`), z. B. ein Ausgang in der EU. Enthält ggf. Zugangsdaten: nie ausgeben. */
1981
+ proxy: z.ZodOptional<z.ZodString>;
1936
1982
  /** Hinweise zur Eingabe (z. B. leerer Selektor), die der Scanner in `scannerWarnings` übernimmt. */
1937
1983
  configWarnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1938
1984
  /** Scanner-Overrides für eigene Banner (CSS-Selektoren bzw. Teilstring der Banner-Frame-URL). */
@@ -1988,6 +2034,7 @@ declare const GateConfigSchema: z.ZodObject<{
1988
2034
  deepBudgetSeconds: number;
1989
2035
  verifyWaitSeconds: number;
1990
2036
  har: boolean;
2037
+ visitor: "ch" | "eu";
1991
2038
  apiKey?: string | undefined;
1992
2039
  githubToken?: string | undefined;
1993
2040
  baseBranch?: string | undefined;
@@ -2002,6 +2049,7 @@ declare const GateConfigSchema: z.ZodObject<{
2002
2049
  recheckPaths?: string[] | undefined;
2003
2050
  extraFirstPartyHosts?: string[] | undefined;
2004
2051
  bannerWaitSeconds?: number | undefined;
2052
+ proxy?: string | undefined;
2005
2053
  configWarnings?: string[] | undefined;
2006
2054
  acceptSelectors?: string[] | undefined;
2007
2055
  rejectSelectors?: string[] | undefined;
@@ -2051,6 +2099,8 @@ declare const GateConfigSchema: z.ZodObject<{
2051
2099
  extraFirstPartyHosts?: string[] | undefined;
2052
2100
  har?: boolean | undefined;
2053
2101
  bannerWaitSeconds?: number | undefined;
2102
+ visitor?: "ch" | "eu" | undefined;
2103
+ proxy?: string | undefined;
2054
2104
  configWarnings?: string[] | undefined;
2055
2105
  acceptSelectors?: string[] | undefined;
2056
2106
  rejectSelectors?: string[] | undefined;
@@ -2245,6 +2295,10 @@ interface CliRawOptions {
2245
2295
  deepBudget?: string | number;
2246
2296
  /** Zustandsdatei der Wiederaufnahme */
2247
2297
  deepState?: string;
2298
+ /** Besucherprofil (ch, eu) */
2299
+ visitor?: string;
2300
+ /** Proxy-URL für alle Browser-Zugriffe (kann Zugangsdaten enthalten) */
2301
+ proxy?: string;
2248
2302
  /** Vorlauf-Report für den Vergleich */
2249
2303
  baseline?: string;
2250
2304
  /** HAR-Mitschnitt */
@@ -2313,6 +2367,8 @@ interface ChaosScannerOptions extends ScannerOverrides {
2313
2367
  sitemapFetcher?: SitemapFetcher;
2314
2368
  /** Fortschritt: wird beim Start jedes Szenarios (und der Schlussprüfung) gerufen; die CLI zeigt daraus eine Zeile. */
2315
2369
  onProgress?: (event: ScanProgress) => void;
2370
+ /** Adresse für die Messung des IP-Lands (Standard `IP_COUNTRY_URL`); Tests geben einen lokalen Dienst mit. */
2371
+ ipCountryUrl?: string;
2316
2372
  }
2317
2373
  /** Fortschritt des Scans: gestartetes Szenario, laufende Nummer, Gesamtzahl, Zeit seit Scanbeginn. */
2318
2374
  interface ScanProgress {
@@ -2334,6 +2390,10 @@ declare class ChaosScanner implements ChaosScannerInterface {
2334
2390
  private frameQueryTimeouts;
2335
2391
  /** User-Agent der Scan-Kontexte (für den Report). */
2336
2392
  private userAgent?;
2393
+ /** Besucherprofil des laufenden Scans (Sprache, Zeitzone) und was davon im Bericht steht. */
2394
+ private visitorProfile;
2395
+ private visitorInfo?;
2396
+ private readonly ipCountryUrl;
2337
2397
  /**
2338
2398
  * Abgebrochene Schritte, die auch nach dem Schliessen ihrer Kontexte nicht endeten. `scan()` kehrt erst zurück, wenn
2339
2399
  * sie nach dem Schliessen des Browsers ausgelaufen sind: sonst könnten sie in einen späteren Lauf derselben Instanz
@@ -2437,6 +2497,11 @@ declare class ChaosScanner implements ChaosScannerInterface {
2437
2497
  private markTimeLimit;
2438
2498
  /** Frame-Abfragen ohne Antwort: Warnung; ohne gesehenen Banner ist «kein Banner» damit nicht belegt. */
2439
2499
  private noteFrameQueryTimeouts;
2500
+ /**
2501
+ * Land der IP, über die der Browser ins Netz geht (über den Proxy, falls gesetzt). Passt es nicht zum Profil, sieht
2502
+ * die Seite einen Besucher aus diesem Land, nicht aus dem Profil: deutliche Warnung, das Ergebnis bleibt gültig.
2503
+ */
2504
+ private measureIpCountry;
2440
2505
  private newContext;
2441
2506
  /**
2442
2507
  * Steht ein Banner-Bedienelement schon im Dokument, wenn kein Skript der Seite läuft? Dann ist das Banner eingebettet
@@ -2708,11 +2773,15 @@ type Jurisdiction = "CH" | "EU" | "UK" | "US-CA" | "BR" | "ROW";
2708
2773
  /**
2709
2774
  * Einwilligungsmodell je Rechtsraum:
2710
2775
  * - `opt-in`: vor Einwilligung blockierend (nicht-essenzielle Tracker). EU, UK, BR.
2776
+ * - `objection` («Widerspruch vor Aktivierung»): Werbe-, Marketing- und Analyse-Tracker vor einer Entscheidung sind
2777
+ * blockierend, rein funktionale Anbieter und cookielose Reichweitenmessung ein Hinweis; dazu blockierend, was nach
2778
+ * Ablehnen weiterläuft oder wo keine Ablehnen-Möglichkeit besteht. CH (seit 0.3.8, Grundlage: Rechtsprüfung PG-01
2779
+ * vom 04.11.2026 zu FMG Art. 45c, DSG Art. 7 Abs. 3 und EDÖB-Leitfaden Cookies V1.1 Ziff. 3.9; vorher `opt-out`).
2711
2780
  * - `opt-out`: Information und wirksame Ablehnen-Möglichkeit genügen; ein Befund vor Einwilligung ist Hinweis,
2712
- * blockierend wird erst, was nach Ablehnen weiterläuft oder wo keine Ablehnen-Möglichkeit besteht. CH, US-CA.
2781
+ * blockierend wird erst, was nach Ablehnen weiterläuft oder wo keine Ablehnen-Möglichkeit besteht. US-CA.
2713
2782
  * - `notice-only`: nie blockierend, nur Bericht (strikte Prüfung nur mit `--strict`). ROW.
2714
2783
  */
2715
- type ConsentModel = "opt-in" | "opt-out" | "notice-only";
2784
+ type ConsentModel = "opt-in" | "objection" | "opt-out" | "notice-only";
2716
2785
  interface JurisdictionProfile {
2717
2786
  code: Jurisdiction;
2718
2787
  label: string;
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  uncheckableReasons,
58
58
  uncheckableReasonsForReport,
59
59
  waitForVerifyUrl
60
- } from "./chunk-PDBLZE7N.js";
60
+ } from "./chunk-IPUQQWLQ.js";
61
61
 
62
62
  // src/index.ts
63
63
  async function runGate(optionsOrConfig) {
@@ -9,8 +9,8 @@
9
9
  **Kategorie:** CI-Gate · Chaos-Scanner · Auto-Fix-PR
10
10
  **Auftraggeber/Pilot:** Beispiel (Platzhalter), Read-only Audit, 20.10.2026
11
11
  **Status:** Gate BLOCKED — 10 Tracker-Leaks vor Einwilligung (Beispielwerte)
12
- **Rechtsraum:** `CH,EU` (Standard). Nach EU (opt-in) blockieren Tracker vor der Einwilligung; nach CH allein (opt-out) wären
13
- die Befunde vor der Einwilligung Hinweise, blockierend bliebe Tracking nach dem Ablehnen.
12
+ **Rechtsraum:** `CH,EU` (Standard). Nach EU (opt-in) und nach CH (Widerspruch vor Aktivierung, seit 0.3.8) blockieren Werbe- und
13
+ Analyse-Tracker vor der Einwilligung; rein funktionale Anbieter und cookielose Reichweitenmessung sind Hinweise.
14
14
 
15
15
  > ⚠️ **Hinweis / Disclaimer:** CPCG ist ein technisches Hilfsmittel zur Unterstützung bei der
16
16
  > Implementierung von Consent-Lösungen — **keine Rechtsberatung** und keine Garantie für
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuonztech-privacy-chaos-gate",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "CuonzTech Privacy Chaos Gate — CI/CD Consent-Scanner, Chaos-Szenarien und Auto-Fix-PR",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",