cuonztech-privacy-chaos-gate 0.4.0 → 0.4.2
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 +4 -2
- package/action.yml +1 -1
- package/dist/{chunk-XL5MZSNK.js → chunk-6DQ3ZLCE.js} +1080 -358
- package/dist/cli.js +15 -6
- package/dist/index.d.ts +30 -2
- package/dist/index.js +9 -3
- package/package.json +1 -1
|
@@ -291,7 +291,7 @@ var RemediationResultSchema = z.object({
|
|
|
291
291
|
});
|
|
292
292
|
var JurisdictionCodeSchema = z.enum(["CH", "CH-SENSIBEL", "EU", "UK", "US-CA", "BR", "ROW"]);
|
|
293
293
|
var GateConfigSchema = z.object({
|
|
294
|
-
targetUrl: z.string().url({ message: "
|
|
294
|
+
targetUrl: z.string().url({ message: "Ung\xFCltige Ziel-URL. Beispiel: https://www.deine-firma.ch" }).refine((u) => /^https?:\/\//i.test(u), { message: "Die Ziel-URL muss mit http:// oder https:// beginnen" }),
|
|
295
295
|
/** LLM-Key — wird nur gesetzt, wenn `llmRemediation` aktiv ist (siehe resolveGateConfig). */
|
|
296
296
|
apiKey: z.string().optional(),
|
|
297
297
|
llmProvider: z.enum(["openai", "anthropic", "gemini"]).default("openai"),
|
|
@@ -388,6 +388,13 @@ var GateConfigSchema = z.object({
|
|
|
388
388
|
* Lauf den Ausgang von CuonzTech. Bei `visitor: both` läuft nur der EU-Besuch darüber. Enthält ggf. Zugangsdaten: nie ausgeben.
|
|
389
389
|
*/
|
|
390
390
|
proxy: z.string().optional(),
|
|
391
|
+
/**
|
|
392
|
+
* Schnelltest ohne Key (`--schnelltest`, Env `CPCG_SCHNELLTEST`, versteckt): der unlizenzierte, gekürzte Lauf für fremde Adressen. Wirkt:
|
|
393
|
+
* User-Agent mit Kennung `CPCG/<Version> (+https://cuonztech.ch/pruefen/info)` (A1), robots.txt der Zielseite beachten (A3), keine
|
|
394
|
+
* Wartezeit auf Challenges und sofortiger Abbruch bei Sperre, Anmeldung, Bezahlschranke oder CAPTCHA (A4), höchstens 3 Unterseiten,
|
|
395
|
+
* kein Sitemap-Tiefenlauf (A9), neutrales Kurzergebnis-PDF ohne Wertung (A6). Ohne die Option bleibt alles wie bisher.
|
|
396
|
+
*/
|
|
397
|
+
schnelltest: z.boolean().default(false),
|
|
391
398
|
/** Hinweise zur Eingabe (z. B. leerer Selektor), die der Scanner in `scannerWarnings` übernimmt. */
|
|
392
399
|
configWarnings: z.array(z.string()).optional(),
|
|
393
400
|
/** Scanner-Overrides für eigene Banner (CSS-Selektoren bzw. Teilstring der Banner-Frame-URL). */
|
|
@@ -516,6 +523,8 @@ function verdictFor(profile, ruleId, trackerCategory, embed = false) {
|
|
|
516
523
|
const rule = ruleId === "tracking-without-consent" ? "pre-consent-tracking" : ruleId ?? "pre-consent-tracking";
|
|
517
524
|
if (profile.consentModel === "notice-only") return "hint";
|
|
518
525
|
if (rule === "gpc-ignored") return profile.code === "US-CA" && trackerCategory === "marketing" ? "block" : "hint";
|
|
526
|
+
if (rule === "reject-less-prominent") return "hint";
|
|
527
|
+
if (rule === "reject-second-level") return profile.consentModel === "opt-in" ? "block" : "hint";
|
|
519
528
|
if (embed && trackerCategory === "functional" && (rule === "pre-consent-tracking" || rule === "pre-consent-embed")) {
|
|
520
529
|
return profile.consentModel === "opt-in" ? "block" : "hint";
|
|
521
530
|
}
|
|
@@ -540,6 +549,12 @@ function hintReasonFor(profiles, ruleId, trackerCategory, embed = false) {
|
|
|
540
549
|
if (rule === "gpc-ignored") {
|
|
541
550
|
return `Nach ${label} Hinweis, nicht blockierend: Tracker trotz Global Privacy Control (GPC). CPCG wertet GPC nur im Modell US-CA (opt-out) und nur f\xFCr Werbe-Tracker als blockierend; in allen anderen Modellen ist es ein Hinweis.`;
|
|
542
551
|
}
|
|
552
|
+
if (rule === "reject-less-prominent") {
|
|
553
|
+
return `Nach ${label} Hinweis, nicht blockierend: gemessen wurde nur, dass \xABAblehnen\xBB kleiner oder schw\xE4cher gestaltet ist als \xABAkzeptieren\xBB; ob das rechtlich gen\xFCgt, ist offen (technische Messung, keine Rechtsbewertung).`;
|
|
554
|
+
}
|
|
555
|
+
if (rule === "reject-second-level") {
|
|
556
|
+
return `Nach ${label} Hinweis, nicht blockierend: \xABAblehnen\xBB gibt es nur in den Einstellungen. Im Modell opt-in (EU) fehlt damit die gleichwertige Wahl auf der ersten Ebene (Befund); hier verlangt der Wortlaut keinen Knopf auf der ersten Ebene, der ED\xD6B \xABmit wenigen Klicks\xBB.`;
|
|
557
|
+
}
|
|
543
558
|
if (rule === "tracking-without-consent") {
|
|
544
559
|
return `Nach ${label} Hinweis, nicht blockierend: ohne gespeicherte Entscheidung beobachtet (Speicher gel\xF6scht), wie vor der Einwilligung.`;
|
|
545
560
|
}
|
|
@@ -1890,8 +1905,12 @@ function broadIgnoreProblems(ignore, allowBroad) {
|
|
|
1890
1905
|
}
|
|
1891
1906
|
return problems;
|
|
1892
1907
|
}
|
|
1908
|
+
function withScheme(raw) {
|
|
1909
|
+
const t = raw.trim();
|
|
1910
|
+
return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}(:\d{1,5})?([/?#]\S*)?$/i.test(t) ? `https://${t}` : raw;
|
|
1911
|
+
}
|
|
1893
1912
|
function formatIssues(issues) {
|
|
1894
|
-
return new Error(`
|
|
1913
|
+
return new Error(`Ung\xFCltige Eingabe:
|
|
1895
1914
|
${issues.map((i) => ` - ${i}`).join("\n")}`);
|
|
1896
1915
|
}
|
|
1897
1916
|
function parseGateConfig(input) {
|
|
@@ -1901,7 +1920,13 @@ function parseGateConfig(input) {
|
|
|
1901
1920
|
}
|
|
1902
1921
|
const broad = broadIgnoreProblems(parsed.data.ignore, parsed.data.allowBroadIgnore);
|
|
1903
1922
|
if (broad.length > 0) throw formatIssues(broad);
|
|
1904
|
-
|
|
1923
|
+
const data = withSchnelltestLimits(parsed.data);
|
|
1924
|
+
return data.llmRemediation ? data : { ...data, apiKey: void 0 };
|
|
1925
|
+
}
|
|
1926
|
+
var SCHNELLTEST_MAX_SUBPAGES = 3;
|
|
1927
|
+
function withSchnelltestLimits(config) {
|
|
1928
|
+
if (!config.schnelltest) return config;
|
|
1929
|
+
return { ...config, maxSubpages: Math.min(config.maxSubpages, SCHNELLTEST_MAX_SUBPAGES), sitemap: false };
|
|
1905
1930
|
}
|
|
1906
1931
|
function resolveGateConfig(cliOptions) {
|
|
1907
1932
|
const problems = [];
|
|
@@ -2009,7 +2034,7 @@ function resolveGateConfig(cliOptions) {
|
|
|
2009
2034
|
scenarios = Array.isArray(cliOptions.scenarios) ? cliOptions.scenarios : cliOptions.scenarios.split(",").map((s) => s.trim()).filter(Boolean);
|
|
2010
2035
|
}
|
|
2011
2036
|
const merged = {
|
|
2012
|
-
targetUrl: cliOptions.url || env.CPCG_TARGET_URL || env.STAGING_URL || "",
|
|
2037
|
+
targetUrl: withScheme(cliOptions.url || env.CPCG_TARGET_URL || env.STAGING_URL || ""),
|
|
2013
2038
|
// LLM-Key nur mit explizitem Opt-in und nur der zum Provider passende Env-Fallback —
|
|
2014
2039
|
// sonst ginge z. B. ein ANTHROPIC_API_KEY als Bearer an api.openai.com.
|
|
2015
2040
|
apiKey: llmRemediation ? cliOptions.apiKey || env.CPCG_LLM_API_KEY || env[LLM_KEY_ENV[llmProvider] ?? ""] || void 0 : void 0,
|
|
@@ -2057,6 +2082,7 @@ function resolveGateConfig(cliOptions) {
|
|
|
2057
2082
|
targetHeaders,
|
|
2058
2083
|
bannerWaitSeconds,
|
|
2059
2084
|
visitor,
|
|
2085
|
+
schnelltest: bool("--schnelltest", cliOptions.schnelltest ?? env.CPCG_SCHNELLTEST, false),
|
|
2060
2086
|
...proxy ? { proxy } : {},
|
|
2061
2087
|
...configWarnings.length > 0 ? { configWarnings } : {}
|
|
2062
2088
|
};
|
|
@@ -2071,7 +2097,7 @@ function resolveGateConfig(cliOptions) {
|
|
|
2071
2097
|
}
|
|
2072
2098
|
if (parsed.success) problems.push(...broadIgnoreProblems(parsed.data.ignore, parsed.data.allowBroadIgnore));
|
|
2073
2099
|
if (problems.length > 0 || !parsed.success) throw formatIssues(problems);
|
|
2074
|
-
return parsed.data;
|
|
2100
|
+
return withSchnelltestLimits(parsed.data);
|
|
2075
2101
|
}
|
|
2076
2102
|
|
|
2077
2103
|
// src/core/license/target.ts
|
|
@@ -2564,13 +2590,19 @@ async function assertReportOutputWritable(reportOutput) {
|
|
|
2564
2590
|
|
|
2565
2591
|
// src/core/orchestrator.ts
|
|
2566
2592
|
import fs12 from "fs/promises";
|
|
2593
|
+
|
|
2594
|
+
// src/core/legal/bannerRules.ts
|
|
2595
|
+
var BANNER_OBSERVATION_RULES = /* @__PURE__ */ new Set(["no-reject-option", "no-consent-choice", "reject-second-level", "reject-less-prominent"]);
|
|
2596
|
+
var isBannerObservation = (ruleId) => BANNER_OBSERVATION_RULES.has(ruleId ?? "");
|
|
2597
|
+
|
|
2598
|
+
// src/core/orchestrator.ts
|
|
2567
2599
|
import os3 from "os";
|
|
2568
2600
|
import path12 from "path";
|
|
2569
2601
|
import pc from "picocolors";
|
|
2570
2602
|
|
|
2571
2603
|
// src/core/scanner/index.ts
|
|
2572
|
-
import
|
|
2573
|
-
import
|
|
2604
|
+
import fs6 from "fs/promises";
|
|
2605
|
+
import path6 from "path";
|
|
2574
2606
|
|
|
2575
2607
|
// src/core/scanner/botProtection.ts
|
|
2576
2608
|
var BLOCK_STATUS = /* @__PURE__ */ new Set([403, 429, 503]);
|
|
@@ -2621,6 +2653,23 @@ function botProtectionFromPage(status, title, html) {
|
|
|
2621
2653
|
for (const m of BLOCKED_PAGE_MARKERS) if (m.test.test(head)) return { status: s, vendor: m.vendor, signal: m.signal };
|
|
2622
2654
|
return void 0;
|
|
2623
2655
|
}
|
|
2656
|
+
var LOGIN_PATH = /(^|\/)(login|log-in|signin|sign-in|anmelden|anmeldung|einloggen|auth|sso)(\/|$)/i;
|
|
2657
|
+
var CAPTCHA_WALL = /geo\.captcha-delivery\.com|id=["']px-captcha["']/i;
|
|
2658
|
+
function schnelltestBlock(input) {
|
|
2659
|
+
const s = input.status ?? void 0;
|
|
2660
|
+
if (s === 401) return { status: s, signal: "HTTP 401 (Anmeldung erforderlich)" };
|
|
2661
|
+
if (s === 402) return { status: s, signal: "HTTP 402 (Bezahlschranke)" };
|
|
2662
|
+
try {
|
|
2663
|
+
const target = new URL(input.targetUrl);
|
|
2664
|
+
const final = new URL(input.finalUrl);
|
|
2665
|
+
if (LOGIN_PATH.test(final.pathname) && !LOGIN_PATH.test(target.pathname)) {
|
|
2666
|
+
return { status: s, signal: "Weiterleitung auf eine Anmeldeseite (Anmeldung erforderlich)" };
|
|
2667
|
+
}
|
|
2668
|
+
} catch {
|
|
2669
|
+
}
|
|
2670
|
+
if (input.html && CAPTCHA_WALL.test(input.html.slice(0, 2e5))) return { status: s, signal: "CAPTCHA-Seite" };
|
|
2671
|
+
return void 0;
|
|
2672
|
+
}
|
|
2624
2673
|
function botProtectionLabel(b) {
|
|
2625
2674
|
const parts = [b.status !== void 0 && !b.signal.includes(String(b.status)) ? `HTTP ${b.status}` : "", b.signal].filter(Boolean);
|
|
2626
2675
|
return `${b.vendor ?? "Zugriffssperre"} (${parts.join(", ")})`;
|
|
@@ -2637,6 +2686,30 @@ var BotProtectionError = class extends Error {
|
|
|
2637
2686
|
protection;
|
|
2638
2687
|
};
|
|
2639
2688
|
|
|
2689
|
+
// src/core/scanner/prominence.ts
|
|
2690
|
+
var LOOK_FUNCTION = `(el) => {
|
|
2691
|
+
const r = el.getBoundingClientRect();
|
|
2692
|
+
const cs = getComputedStyle(el);
|
|
2693
|
+
const parts = cs.backgroundColor.replace(/[^0-9.,]/g, "").split(",");
|
|
2694
|
+
const alpha = parts.length === 4 ? parseFloat(parts[3]) : parts.length === 3 ? 1 : 0;
|
|
2695
|
+
const bw = parseFloat(cs.borderTopWidth) || 0;
|
|
2696
|
+
return { w: Math.round(r.width), h: Math.round(r.height), font: parseFloat(cs.fontSize) || 0, filled: alpha > 0.5, bordered: bw >= 1 && cs.borderTopStyle !== "none" };
|
|
2697
|
+
}`;
|
|
2698
|
+
var usable = (b) => !!b && Number.isFinite(b.w) && Number.isFinite(b.h) && b.w > 0 && b.h > 0;
|
|
2699
|
+
function prominenceReasons(accept, reject) {
|
|
2700
|
+
if (!usable(accept) || !usable(reject)) return [];
|
|
2701
|
+
const reasons = [];
|
|
2702
|
+
const height = reject.h / accept.h;
|
|
2703
|
+
if (height < 0.6) reasons.push(`H\xF6he von \xABAblehnen\xBB nur ${Math.round(height * 100)} % der H\xF6he von \xABAkzeptieren\xBB`);
|
|
2704
|
+
if (accept.filled && !reject.filled && !reject.bordered) reasons.push("\xABAblehnen\xBB nur als Text, \xABAkzeptieren\xBB als gef\xFCllter Knopf");
|
|
2705
|
+
if (accept.font > 0 && reject.font > 0 && reject.font / accept.font < 0.8) reasons.push(`Schriftgr\xF6sse von \xABAblehnen\xBB ${reject.font} px gegen ${accept.font} px`);
|
|
2706
|
+
return reasons;
|
|
2707
|
+
}
|
|
2708
|
+
var lookText = (b) => `${b.w}\xD7${b.h} px, Schrift ${b.font} px, ${b.filled ? "gef\xFCllt" : b.bordered ? "nur Rahmen" : "nur Text"}`;
|
|
2709
|
+
function prominenceDescription(accept, reject, reasons) {
|
|
2710
|
+
return `Gemessen auf der ersten Ebene des Banners: \xABAkzeptieren\xBB ${lookText(accept)}; \xABAblehnen\xBB ${lookText(reject)}. ${reasons.join("; ")}. Technische Messung, keine Rechtsbewertung.`;
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2640
2713
|
// src/core/scanner/cnameCloaking.ts
|
|
2641
2714
|
import dns from "dns/promises";
|
|
2642
2715
|
|
|
@@ -2907,7 +2980,7 @@ function trackersInScript(text, scriptUrl) {
|
|
|
2907
2980
|
}
|
|
2908
2981
|
return [...found];
|
|
2909
2982
|
}
|
|
2910
|
-
async function trackServiceWorkers(context) {
|
|
2983
|
+
async function trackServiceWorkers(context, userAgent) {
|
|
2911
2984
|
await context.exposeBinding("__cpcgSwRegister", (source, scriptUrl) => {
|
|
2912
2985
|
const watch = contextWatches.get(context);
|
|
2913
2986
|
if (!watch || typeof scriptUrl !== "string") return;
|
|
@@ -2924,7 +2997,7 @@ async function trackServiceWorkers(context) {
|
|
|
2924
2997
|
watch.pending.push(
|
|
2925
2998
|
(async () => {
|
|
2926
2999
|
try {
|
|
2927
|
-
const res = await fetch(scriptUrl, { signal: AbortSignal.timeout(4e3), redirect: "error" });
|
|
3000
|
+
const res = await fetch(scriptUrl, { signal: AbortSignal.timeout(4e3), redirect: "error", ...userAgent ? { headers: { "User-Agent": userAgent } } : {} });
|
|
2928
3001
|
const text = (await res.text()).slice(0, 1e6);
|
|
2929
3002
|
const trackers = trackersInScript(text, scriptUrl);
|
|
2930
3003
|
if (trackers.length > 0) {
|
|
@@ -5128,9 +5201,184 @@ async function bannerSurroundings(target) {
|
|
|
5128
5201
|
}
|
|
5129
5202
|
|
|
5130
5203
|
// src/core/scanner/browserUserAgent.ts
|
|
5204
|
+
import { createRequire } from "module";
|
|
5131
5205
|
import { chromium } from "playwright";
|
|
5206
|
+
|
|
5207
|
+
// src/core/report/provenance.ts
|
|
5208
|
+
import { createHash } from "crypto";
|
|
5209
|
+
import fs5 from "fs/promises";
|
|
5210
|
+
import path5 from "path";
|
|
5211
|
+
var CPCG_VERSION = true ? "0.4.2" : "dev";
|
|
5212
|
+
function scanConfigOf(config) {
|
|
5213
|
+
return {
|
|
5214
|
+
targetUrl: config.targetUrl,
|
|
5215
|
+
scenarios: config.scenarios?.length ? [...config.scenarios].sort() : "alle",
|
|
5216
|
+
// Reihenfolge der Rechtsräume ändert die Prüfung nicht («EU,CH» = «CH,EU»).
|
|
5217
|
+
jurisdiction: config.jurisdiction.split(",").map((j) => j.trim()).filter(Boolean).sort().join(","),
|
|
5218
|
+
strict: config.strict,
|
|
5219
|
+
ignore: [...config.ignore].sort(),
|
|
5220
|
+
timeoutMs: config.timeoutMs,
|
|
5221
|
+
maxSubpages: config.maxSubpages,
|
|
5222
|
+
sitemap: config.sitemap,
|
|
5223
|
+
...config.sitemap ? { deepBudgetSeconds: config.deepBudgetSeconds, resume: Boolean(config.deepStateFile) } : {},
|
|
5224
|
+
bannerWaitSeconds: config.bannerWaitSeconds ?? null,
|
|
5225
|
+
acceptSelectors: config.acceptSelectors ?? [],
|
|
5226
|
+
rejectSelectors: config.rejectSelectors ?? [],
|
|
5227
|
+
settingsSelectors: config.settingsSelectors ?? [],
|
|
5228
|
+
bannerFrame: config.bannerFrame ?? null,
|
|
5229
|
+
headless: config.headless,
|
|
5230
|
+
// Besucherprofil und Ausgang gehören zur Prüfung; der Proxy nur ohne Zugangsdaten (zwei Ausgänge = zwei Konfigurationen).
|
|
5231
|
+
visitor: config.visitor ?? "ch",
|
|
5232
|
+
proxy: config.proxy ? redactProxy(config.proxy) : null,
|
|
5233
|
+
// Nur die Namen der Freigabe-Header: die Werte sind Geheimnisse.
|
|
5234
|
+
targetHeaders: Object.keys(config.targetHeaders ?? {}).sort()
|
|
5235
|
+
};
|
|
5236
|
+
}
|
|
5237
|
+
function canonicalJson(value) {
|
|
5238
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
5239
|
+
if (value && typeof value === "object") {
|
|
5240
|
+
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
5241
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
5242
|
+
}
|
|
5243
|
+
return JSON.stringify(value);
|
|
5244
|
+
}
|
|
5245
|
+
var sha256 = (data) => createHash("sha256").update(data).digest("hex");
|
|
5246
|
+
function buildProvenance(config, browser) {
|
|
5247
|
+
const scanConfig = scanConfigOf(config);
|
|
5248
|
+
return {
|
|
5249
|
+
tool: "cpcg",
|
|
5250
|
+
version: CPCG_VERSION,
|
|
5251
|
+
configHash: sha256(canonicalJson(scanConfig)),
|
|
5252
|
+
config: scanConfig,
|
|
5253
|
+
...browser ? { browser } : {},
|
|
5254
|
+
node: process.version,
|
|
5255
|
+
platform: `${process.platform}-${process.arch}`
|
|
5256
|
+
};
|
|
5257
|
+
}
|
|
5258
|
+
async function writeManifest(reportDir, base, files, meta) {
|
|
5259
|
+
const entries = [];
|
|
5260
|
+
for (const file of [...new Set(files.map((f) => path5.resolve(f)))].sort()) {
|
|
5261
|
+
const data = await fs5.readFile(file).catch(() => null);
|
|
5262
|
+
if (!data) continue;
|
|
5263
|
+
entries.push({ path: path5.relative(reportDir, file).split(path5.sep).join("/"), sha256: sha256(data), bytes: data.length });
|
|
5264
|
+
}
|
|
5265
|
+
const jsonPath = `${base}-manifest.json`;
|
|
5266
|
+
const sumPath = `${base}-manifest.sha256`;
|
|
5267
|
+
await fs5.writeFile(jsonPath, `${JSON.stringify({ tool: "cpcg", ...meta, files: entries }, null, 2)}
|
|
5268
|
+
`, "utf-8");
|
|
5269
|
+
await fs5.writeFile(sumPath, entries.map((e) => `${e.sha256} ${e.path}`).join("\n") + "\n", "utf-8");
|
|
5270
|
+
return { jsonPath, sumPath, entries };
|
|
5271
|
+
}
|
|
5272
|
+
var hostOf = (url) => {
|
|
5273
|
+
if (url.startsWith("cookie:")) return url.slice(url.lastIndexOf("@") + 1) || "cookie";
|
|
5274
|
+
try {
|
|
5275
|
+
return new URL(url).hostname;
|
|
5276
|
+
} catch {
|
|
5277
|
+
return "";
|
|
5278
|
+
}
|
|
5279
|
+
};
|
|
5280
|
+
function findingsOf(report) {
|
|
5281
|
+
const out = /* @__PURE__ */ new Map();
|
|
5282
|
+
for (const v of report.violations ?? []) {
|
|
5283
|
+
const ruleId = v.ruleId ?? "pre-consent-tracking";
|
|
5284
|
+
const host = hostOf(v.requestUrl);
|
|
5285
|
+
const key = `${ruleId}|${v.trackerName}|${host}`;
|
|
5286
|
+
const cur = out.get(key);
|
|
5287
|
+
if (cur) {
|
|
5288
|
+
cur.count++;
|
|
5289
|
+
if (!cur.scenarios.includes(v.scenario)) cur.scenarios.push(v.scenario);
|
|
5290
|
+
cur.advisory &&= v.advisory === true;
|
|
5291
|
+
} else {
|
|
5292
|
+
out.set(key, { ruleId, trackerName: v.trackerName, host, scenarios: [v.scenario], count: 1, advisory: v.advisory === true });
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
return out;
|
|
5296
|
+
}
|
|
5297
|
+
var ROUTE_SCENARIOS = /* @__PURE__ */ new Set(["subpage-spa", "consent-persistence"]);
|
|
5298
|
+
function recheckedIn(current, f) {
|
|
5299
|
+
const checked = new Set((current.evidence ?? []).filter((e) => e.status === "passed" || e.status === "suspicious").map((e) => e.scenario));
|
|
5300
|
+
if (!f.scenarios.every((s2) => checked.has(s2))) return false;
|
|
5301
|
+
const s = current.subpageSampling;
|
|
5302
|
+
const complete = s ? (s.checkedTotal ?? s.checked) >= s.linked && s.source !== "sitemap" : false;
|
|
5303
|
+
return !f.scenarios.some((sc) => ROUTE_SCENARIOS.has(sc)) || complete;
|
|
5304
|
+
}
|
|
5305
|
+
function compareReports(current, baseline) {
|
|
5306
|
+
const now = findingsOf(current);
|
|
5307
|
+
const before = findingsOf(baseline);
|
|
5308
|
+
const baseProv = baseline.provenance;
|
|
5309
|
+
const curProv = current.provenance;
|
|
5310
|
+
const statusOf = (r) => new Map((r.evidence ?? []).map((e) => [e.scenario, e.status]));
|
|
5311
|
+
const sBefore = statusOf(baseline);
|
|
5312
|
+
const scenarioChanges = [];
|
|
5313
|
+
for (const [scenario, after] of statusOf(current)) {
|
|
5314
|
+
const prev = sBefore.get(scenario);
|
|
5315
|
+
if (prev && prev !== after) scenarioChanges.push({ scenario, before: prev, after });
|
|
5316
|
+
}
|
|
5317
|
+
return {
|
|
5318
|
+
...baseline.scannedAt ? { baselineScannedAt: baseline.scannedAt } : {},
|
|
5319
|
+
...baseProv?.version ? { baselineVersion: baseProv.version } : {},
|
|
5320
|
+
sameTarget: baseline.targetUrl === current.targetUrl,
|
|
5321
|
+
...baseProv?.configHash && curProv?.configHash ? { sameConfig: baseProv.configHash === curProv.configHash } : {},
|
|
5322
|
+
...baseProv?.version && curProv?.version ? { sameVersion: baseProv.version === curProv.version } : {},
|
|
5323
|
+
newFindings: [...now].filter(([k]) => !before.has(k)).map(([, f]) => f),
|
|
5324
|
+
resolvedFindings: [...before].filter(([k]) => !now.has(k)).map(([, f]) => f).filter((f) => recheckedIn(current, f)),
|
|
5325
|
+
notRechecked: [...before].filter(([k]) => !now.has(k)).map(([, f]) => f).filter((f) => !recheckedIn(current, f)),
|
|
5326
|
+
unchangedFindings: [...now.keys()].filter((k) => before.has(k)).length,
|
|
5327
|
+
scenarioChanges
|
|
5328
|
+
};
|
|
5329
|
+
}
|
|
5330
|
+
var STATUSES = /* @__PURE__ */ new Set(["passed", "suspicious", "not-checkable", "not-applicable"]);
|
|
5331
|
+
var str = (v, max = 2e3) => typeof v === "string" && v.length <= max;
|
|
5332
|
+
async function loadBaseline(file) {
|
|
5333
|
+
const name = path5.basename(file);
|
|
5334
|
+
let raw;
|
|
5335
|
+
try {
|
|
5336
|
+
raw = await fs5.readFile(file, "utf-8");
|
|
5337
|
+
} catch (err) {
|
|
5338
|
+
return { error: `Vorlauf nicht lesbar (${err.code ?? "Fehler"}): ${name}` };
|
|
5339
|
+
}
|
|
5340
|
+
let parsed;
|
|
5341
|
+
try {
|
|
5342
|
+
parsed = JSON.parse(raw);
|
|
5343
|
+
} catch {
|
|
5344
|
+
return { error: `Vorlauf ist kein g\xFCltiges JSON: ${name}` };
|
|
5345
|
+
}
|
|
5346
|
+
if (!parsed || typeof parsed !== "object" || !str(parsed.targetUrl) || !Array.isArray(parsed.violations)) {
|
|
5347
|
+
return { error: `Vorlauf ist kein CPCG-Report (targetUrl/violations fehlen): ${name}` };
|
|
5348
|
+
}
|
|
5349
|
+
const rawViolations = parsed.violations;
|
|
5350
|
+
const violations = rawViolations.filter(
|
|
5351
|
+
(v) => v && typeof v === "object" && str(v.requestUrl) && str(v.trackerName, 300) && str(v.scenario, 100) && (v.ruleId === void 0 || str(v.ruleId, 100))
|
|
5352
|
+
);
|
|
5353
|
+
const evidence = (Array.isArray(parsed.evidence) ? parsed.evidence : []).filter(
|
|
5354
|
+
(e) => e && typeof e === "object" && str(e.scenario, 100) && typeof e.status === "string" && STATUSES.has(e.status)
|
|
5355
|
+
);
|
|
5356
|
+
const prov = parsed.provenance;
|
|
5357
|
+
const report = {
|
|
5358
|
+
...parsed,
|
|
5359
|
+
violations,
|
|
5360
|
+
evidence: evidence.map((e) => ({ scenario: e.scenario, status: e.status })),
|
|
5361
|
+
scannedAt: str(parsed.scannedAt, 100) ? parsed.scannedAt : void 0,
|
|
5362
|
+
provenance: prov && typeof prov === "object" && str(prov.configHash, 100) && str(prov.version, 100) ? { configHash: prov.configHash, version: prov.version } : void 0
|
|
5363
|
+
};
|
|
5364
|
+
const dropped = rawViolations.length - violations.length;
|
|
5365
|
+
return { report, ...dropped > 0 ? { dropped } : {} };
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5368
|
+
// src/core/scanner/browserUserAgent.ts
|
|
5132
5369
|
var SCAN_BROWSER_CHANNEL = "chromium";
|
|
5133
|
-
var BROWSER_INSTALL_HINT = "npx playwright install
|
|
5370
|
+
var BROWSER_INSTALL_HINT = "npx playwright install chromium";
|
|
5371
|
+
function playwrightVersion() {
|
|
5372
|
+
try {
|
|
5373
|
+
const v = createRequire(import.meta.url)("playwright/package.json").version;
|
|
5374
|
+
return typeof v === "string" && /^\d+\.\d+\.\d+/.test(v) ? v : void 0;
|
|
5375
|
+
} catch {
|
|
5376
|
+
return void 0;
|
|
5377
|
+
}
|
|
5378
|
+
}
|
|
5379
|
+
function exactInstallHint(version = playwrightVersion()) {
|
|
5380
|
+
return version ? ` Fehlt der Browser danach weiterhin, passt die Version nicht: npx playwright@${version} install chromium.` : "";
|
|
5381
|
+
}
|
|
5134
5382
|
function platformToken(platform = process.platform) {
|
|
5135
5383
|
if (platform === "darwin") return "Macintosh; Intel Mac OS X 10_15_7";
|
|
5136
5384
|
if (platform === "linux") return "X11; Linux x86_64";
|
|
@@ -5141,6 +5389,14 @@ function browserUserAgent(browserVersion, platform = process.platform) {
|
|
|
5141
5389
|
if (!m) return void 0;
|
|
5142
5390
|
return `Mozilla/5.0 (${platformToken(platform)}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${m[1]}.0.0.0 Safari/537.36`;
|
|
5143
5391
|
}
|
|
5392
|
+
var SCHNELLTEST_INFO_URL = "https://cuonztech.ch/pruefen/info";
|
|
5393
|
+
function schnelltestUserAgentSuffix(version = CPCG_VERSION) {
|
|
5394
|
+
return ` CPCG/${version} (+${SCHNELLTEST_INFO_URL})`;
|
|
5395
|
+
}
|
|
5396
|
+
function withSchnelltestUserAgent(userAgent, version = CPCG_VERSION) {
|
|
5397
|
+
const base = userAgent ?? `Mozilla/5.0 (${platformToken()}) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36`;
|
|
5398
|
+
return base.includes(" CPCG/") ? base : `${base}${schnelltestUserAgentSuffix(version)}`;
|
|
5399
|
+
}
|
|
5144
5400
|
function isMissingBrowserError(err) {
|
|
5145
5401
|
const message = err instanceof Error ? err.message : String(err);
|
|
5146
5402
|
return /Executable doesn't exist|Looks like Playwright was just installed|please run the following command to download new browsers|Chromium distribution '.*' is not found/i.test(
|
|
@@ -5153,11 +5409,104 @@ async function launchScanBrowser(options, launch = (o) => chromium.launch(o)) {
|
|
|
5153
5409
|
} catch (err) {
|
|
5154
5410
|
if (!isMissingBrowserError(err)) throw err;
|
|
5155
5411
|
throw new Error(
|
|
5156
|
-
`Browser fehlt: CPCG braucht das vollwertige Chromium von Playwright (nicht nur die Headless-Shell). Installieren mit: ${BROWSER_INSTALL_HINT}`
|
|
5412
|
+
`Browser fehlt: CPCG braucht das vollwertige Chromium von Playwright (nicht nur die Headless-Shell). Installieren mit: ${BROWSER_INSTALL_HINT} (Download einige hundert MB; unter Linux zus\xE4tzlich --with-deps).${exactInstallHint()}`
|
|
5157
5413
|
);
|
|
5158
5414
|
}
|
|
5159
5415
|
}
|
|
5160
5416
|
|
|
5417
|
+
// src/core/scanner/robotsRules.ts
|
|
5418
|
+
var ROBOTS_AGENT = "cpcg";
|
|
5419
|
+
var agentApplies = (value) => {
|
|
5420
|
+
const v = value.trim().toLowerCase();
|
|
5421
|
+
return v === "*" || v.startsWith(ROBOTS_AGENT);
|
|
5422
|
+
};
|
|
5423
|
+
function patternToRegExp(pattern) {
|
|
5424
|
+
const anchored = pattern.endsWith("$");
|
|
5425
|
+
const body = anchored ? pattern.slice(0, -1) : pattern;
|
|
5426
|
+
const source = body.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
5427
|
+
return new RegExp(`^${source}${anchored ? "$" : ""}`);
|
|
5428
|
+
}
|
|
5429
|
+
function pathOf(urlOrPath) {
|
|
5430
|
+
try {
|
|
5431
|
+
const u = new URL(urlOrPath, "http://robots.invalid");
|
|
5432
|
+
return `${u.pathname}${u.search}`;
|
|
5433
|
+
} catch {
|
|
5434
|
+
return void 0;
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
function parseRobotsRules(text) {
|
|
5438
|
+
const rules = [];
|
|
5439
|
+
let agents = [];
|
|
5440
|
+
let collecting = false;
|
|
5441
|
+
for (const raw of text.replace(/^/, "").split(/\r?\n/)) {
|
|
5442
|
+
const line = raw.replace(/#.*$/, "").trim();
|
|
5443
|
+
const m = /^([A-Za-z-]+)\s*:\s*(.*)$/.exec(line);
|
|
5444
|
+
if (!m) continue;
|
|
5445
|
+
const field = m[1].toLowerCase();
|
|
5446
|
+
const value = m[2].trim();
|
|
5447
|
+
if (field === "user-agent") {
|
|
5448
|
+
if (!collecting) agents = [];
|
|
5449
|
+
agents.push(agentApplies(value));
|
|
5450
|
+
collecting = true;
|
|
5451
|
+
} else if (field === "allow" || field === "disallow") {
|
|
5452
|
+
collecting = false;
|
|
5453
|
+
if (!agents.some(Boolean)) continue;
|
|
5454
|
+
if (value === "") continue;
|
|
5455
|
+
rules.push({ allow: field === "allow", pattern: value });
|
|
5456
|
+
} else {
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
const compiled = rules.map((r) => ({ ...r, re: patternToRegExp(r.pattern) }));
|
|
5460
|
+
return {
|
|
5461
|
+
rules,
|
|
5462
|
+
allows(urlOrPath) {
|
|
5463
|
+
const p = pathOf(urlOrPath);
|
|
5464
|
+
if (p === void 0) return true;
|
|
5465
|
+
let best;
|
|
5466
|
+
for (const r of compiled) {
|
|
5467
|
+
if (!r.re.test(p)) continue;
|
|
5468
|
+
const length = r.pattern.length;
|
|
5469
|
+
if (!best || length > best.length || length === best.length && r.allow && !best.allow) best = { allow: r.allow, length };
|
|
5470
|
+
}
|
|
5471
|
+
return best ? best.allow : true;
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
var NO_ROBOTS_RULES = parseRobotsRules("");
|
|
5476
|
+
async function fetchRobotsRules(origin, options = {}) {
|
|
5477
|
+
const { timeoutMs = 8e3, maxBytes = 1e5, userAgent, fetchImpl = fetch } = options;
|
|
5478
|
+
try {
|
|
5479
|
+
const res = await fetchImpl(new URL("/robots.txt", origin).href, {
|
|
5480
|
+
redirect: "manual",
|
|
5481
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
5482
|
+
...userAgent ? { headers: { "User-Agent": userAgent } } : {}
|
|
5483
|
+
});
|
|
5484
|
+
if (res.status !== 200) {
|
|
5485
|
+
await res.body?.cancel().catch(() => {
|
|
5486
|
+
});
|
|
5487
|
+
return NO_ROBOTS_RULES;
|
|
5488
|
+
}
|
|
5489
|
+
const chunks = [];
|
|
5490
|
+
let size = 0;
|
|
5491
|
+
const reader = res.body?.getReader();
|
|
5492
|
+
if (!reader) return parseRobotsRules((await res.text()).slice(0, maxBytes));
|
|
5493
|
+
for (; ; ) {
|
|
5494
|
+
const { done, value } = await reader.read();
|
|
5495
|
+
if (done || !value) break;
|
|
5496
|
+
chunks.push(value);
|
|
5497
|
+
size += value.byteLength;
|
|
5498
|
+
if (size >= maxBytes) {
|
|
5499
|
+
await reader.cancel().catch(() => {
|
|
5500
|
+
});
|
|
5501
|
+
break;
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
return parseRobotsRules(Buffer.concat(chunks).subarray(0, maxBytes).toString("utf-8"));
|
|
5505
|
+
} catch {
|
|
5506
|
+
return NO_ROBOTS_RULES;
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5161
5510
|
// src/core/scanner/index.ts
|
|
5162
5511
|
var EMPTY_STORAGE = { cookies: [], localStorageKeys: [], sessionStorageKeys: [] };
|
|
5163
5512
|
var NON_PAGE_LINK = /\.(pdf|zip|gz|tar|exe|dmg|apk|jpe?g|png|gif|webp|svg|ico|mp3|mp4|webm|docx?|xlsx?|pptx?|csv|xml|rss|json|txt)$/i;
|
|
@@ -5200,11 +5549,11 @@ function isFirstPartyGoogleMeasurement(t) {
|
|
|
5200
5549
|
function asScope(s) {
|
|
5201
5550
|
return typeof s === "string" ? new TargetScope(s) : s;
|
|
5202
5551
|
}
|
|
5203
|
-
async function collectSameOriginLinks(page, scopeOrOrigin, max = 8) {
|
|
5204
|
-
return (await collectLinkSample(page, scopeOrOrigin, max)).picked;
|
|
5552
|
+
async function collectSameOriginLinks(page, scopeOrOrigin, max = 8, allow) {
|
|
5553
|
+
return (await collectLinkSample(page, scopeOrOrigin, max, allow)).picked;
|
|
5205
5554
|
}
|
|
5206
5555
|
var LOW_PRIORITY_LINK = /impressum|imprint|datenschutz|privacy|agb\b|terms|nutzungsbedingungen|rechtliches|legal|disclaimer|haftung|sitemap|kontakt|contact|cookie/i;
|
|
5207
|
-
async function collectLinkSample(page, scopeOrOrigin, max = 8) {
|
|
5556
|
+
async function collectLinkSample(page, scopeOrOrigin, max = 8, allow) {
|
|
5208
5557
|
const scope = asScope(scopeOrOrigin);
|
|
5209
5558
|
const anchors = await page.evaluate(
|
|
5210
5559
|
() => Array.from(document.querySelectorAll("a[href]")).map((a) => {
|
|
@@ -5246,6 +5595,7 @@ async function collectLinkSample(page, scopeOrOrigin, max = 8) {
|
|
|
5246
5595
|
u.hash = "";
|
|
5247
5596
|
if (u.href === current || seen.has(u.href)) continue;
|
|
5248
5597
|
if (!scope.has(u.href)) continue;
|
|
5598
|
+
if (allow && !allow(u.href)) continue;
|
|
5249
5599
|
seen.add(u.href);
|
|
5250
5600
|
const entry = { href: u.href, segment: u.pathname.split("/")[1]?.toLowerCase() ?? "" };
|
|
5251
5601
|
(footer || LOW_PRIORITY_LINK.test(`${u.pathname} ${text}`) ? secondary : content).push(entry);
|
|
@@ -5265,7 +5615,7 @@ async function collectLinkSample(page, scopeOrOrigin, max = 8) {
|
|
|
5265
5615
|
}
|
|
5266
5616
|
return { picked, total: ordered.length };
|
|
5267
5617
|
}
|
|
5268
|
-
async function clickFirstSameOriginLink(page, scopeOrOrigin) {
|
|
5618
|
+
async function clickFirstSameOriginLink(page, scopeOrOrigin, allow) {
|
|
5269
5619
|
const scope = asScope(scopeOrOrigin);
|
|
5270
5620
|
const anchors = await page.evaluate(
|
|
5271
5621
|
() => Array.from(document.querySelectorAll("a[href]")).map((a) => {
|
|
@@ -5281,7 +5631,7 @@ async function clickFirstSameOriginLink(page, scopeOrOrigin) {
|
|
|
5281
5631
|
).catch(() => []);
|
|
5282
5632
|
let index = anchors.findIndex((href) => {
|
|
5283
5633
|
if (!href || !/^https?:/i.test(href)) return false;
|
|
5284
|
-
return scope.has(href);
|
|
5634
|
+
return scope.has(href) && (!allow || allow(href));
|
|
5285
5635
|
});
|
|
5286
5636
|
if (index < 0) index = anchors.findIndex((href) => href.startsWith("#"));
|
|
5287
5637
|
if (index < 0) return false;
|
|
@@ -5587,6 +5937,10 @@ var ChaosScanner = class {
|
|
|
5587
5937
|
bannerIssue;
|
|
5588
5938
|
/** Der Banner bietet nur einen Hinweis (kein Akzeptieren, kein Ablehnen); Text für die Scanner-Warnung. */
|
|
5589
5939
|
infoOnlyBanner;
|
|
5940
|
+
/** «Ablehnen» war nur über die Einstellungen (zweite Ebene) erreichbar: wird nach den Szenarien als Befund `reject-second-level` gebucht. */
|
|
5941
|
+
rejectOnlySecondLevel = false;
|
|
5942
|
+
/** Gestaltung von «Akzeptieren» und «Ablehnen» auf der ersten Ebene, vor dem Klick gemessen (Grundlage für `reject-less-prominent`). */
|
|
5943
|
+
prominence;
|
|
5590
5944
|
/** Erster erkannter Bot-Schutz der Hauptseite (Challenge, Sperre, Rate-Limit) in diesem Lauf. */
|
|
5591
5945
|
botProtection;
|
|
5592
5946
|
/** Kategorien, die die Seite in ihren Einstellungen als nicht abwählbar ausweist (gesperrt, eingeschaltet). */
|
|
@@ -5597,6 +5951,14 @@ var ChaosScanner = class {
|
|
|
5597
5951
|
siteNecessaryMore = false;
|
|
5598
5952
|
/** Eine Challenge hat sich innerhalb der Wartezeit nicht gelöst: in diesem Lauf nicht mehr warten. */
|
|
5599
5953
|
challengeUnsolved = false;
|
|
5954
|
+
/** Schnelltest ohne Key (`--schnelltest`): Kennung im User-Agent, robots.txt, keine Challenge-Wartezeit, Abbruch bei Sperre. */
|
|
5955
|
+
schnelltest = false;
|
|
5956
|
+
/** Regeln der robots.txt der Zielseite (nur im Schnelltest gelesen), für die Auswahl der Unterseiten. */
|
|
5957
|
+
robots = NO_ROBOTS_RULES;
|
|
5958
|
+
/** Schnelltest: eine Unterseite hat gesperrt (401, 402, 403, 429); weitere Unterseiten werden nicht mehr angefragt. */
|
|
5959
|
+
subpageBlocked = false;
|
|
5960
|
+
/** Darf der Roboter diese Adresse besuchen? Ausserhalb des Schnelltests immer ja. */
|
|
5961
|
+
robotsAllow = (url) => !this.schnelltest || this.robots.allows(url);
|
|
5600
5962
|
/** CNAME-Cloaking: je Lauf neu, damit die Obergrenze und der Cache je Ziel gelten. */
|
|
5601
5963
|
cnameResolver;
|
|
5602
5964
|
sitemapFetcher;
|
|
@@ -5677,7 +6039,10 @@ var ChaosScanner = class {
|
|
|
5677
6039
|
this.headerOrigins = /* @__PURE__ */ new Set([new URL(config.targetUrl).origin]);
|
|
5678
6040
|
this.bannerWaitExplicit = config.bannerWaitSeconds !== void 0;
|
|
5679
6041
|
this.bannerWaitMs = config.bannerWaitSeconds !== void 0 ? Math.round(config.bannerWaitSeconds * 1e3) : BANNER_WAIT_MS;
|
|
5680
|
-
this.
|
|
6042
|
+
this.schnelltest = config.schnelltest === true;
|
|
6043
|
+
this.robots = NO_ROBOTS_RULES;
|
|
6044
|
+
this.subpageBlocked = false;
|
|
6045
|
+
this.maxSubpages = this.schnelltest ? Math.min(config.maxSubpages ?? 12, 3) : config.maxSubpages ?? 12;
|
|
5681
6046
|
this.bannerProbe = "none";
|
|
5682
6047
|
this.frameQueryTimeouts = 0;
|
|
5683
6048
|
this.visitorProfile = visitProfile(config.visitor);
|
|
@@ -5705,12 +6070,12 @@ var ChaosScanner = class {
|
|
|
5705
6070
|
this.watches = /* @__PURE__ */ new Map();
|
|
5706
6071
|
this.gtmLoaderExempt = false;
|
|
5707
6072
|
this.warnings = [...config.configWarnings ?? []];
|
|
5708
|
-
this.evidenceDir ??=
|
|
6073
|
+
this.evidenceDir ??= path6.join(path6.dirname(path6.resolve(config.reportOutput)), "evidence");
|
|
5709
6074
|
const runStamp = `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}-${Math.random().toString(36).slice(2, 6)}`;
|
|
5710
|
-
this.harDir = config.har ?
|
|
6075
|
+
this.harDir = config.har ? path6.join(path6.dirname(path6.resolve(config.reportOutput)), "evidence", "har", runStamp) : void 0;
|
|
5711
6076
|
this.harCount = 0;
|
|
5712
6077
|
this.harFiles = [];
|
|
5713
|
-
if (this.harDir) await
|
|
6078
|
+
if (this.harDir) await fs6.mkdir(this.harDir, { recursive: true });
|
|
5714
6079
|
const want = (s) => !config.scenarios?.length || config.scenarios.includes(s);
|
|
5715
6080
|
const steps = ChaosScenarioSchema.options.filter(want).length + (want("happy-path-denied") || want("happy-path-accepted") ? 1 : 0);
|
|
5716
6081
|
let stepIndex = 0;
|
|
@@ -5731,8 +6096,15 @@ var ChaosScanner = class {
|
|
|
5731
6096
|
const preflightTimeout = Math.min(Math.max(config.timeoutMs, 3e3), 15e3);
|
|
5732
6097
|
const preflight = (method) => this.targetHeaders ? fetchWithTargetHeaders(config.targetUrl, { method, timeoutMs: preflightTimeout }, this.targetHeaders, () => [
|
|
5733
6098
|
...this.headerOrigins
|
|
5734
|
-
]).then((r) => ({ url: r.url })) : fetch(config.targetUrl, {
|
|
6099
|
+
]).then((r) => ({ url: r.url })) : fetch(config.targetUrl, {
|
|
6100
|
+
method,
|
|
6101
|
+
signal: AbortSignal.timeout(preflightTimeout),
|
|
6102
|
+
// Schnelltest: auch die Vorabfrage trägt die Kennung (nie eine Navigation ohne Zusatz)
|
|
6103
|
+
...this.schnelltest ? { headers: { "User-Agent": withSchnelltestUserAgent(void 0) } } : {}
|
|
6104
|
+
});
|
|
6105
|
+
let finalTargetUrl = config.targetUrl;
|
|
5735
6106
|
const noteFinal = (finalUrl) => {
|
|
6107
|
+
finalTargetUrl = finalUrl;
|
|
5736
6108
|
scope.add(finalUrl);
|
|
5737
6109
|
try {
|
|
5738
6110
|
const f = new URL(finalUrl);
|
|
@@ -5750,7 +6122,15 @@ var ChaosScanner = class {
|
|
|
5750
6122
|
} catch {
|
|
5751
6123
|
await new Promise((r) => setTimeout(r, 150));
|
|
5752
6124
|
throw new Error(
|
|
5753
|
-
`
|
|
6125
|
+
`Ziel-URL nicht erreichbar: ${config.targetUrl}. Bitte pr\xFCfen: URL korrekt, Server erreichbar, ggf. --timeout-ms erh\xF6hen.`
|
|
6126
|
+
);
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6129
|
+
if (this.schnelltest) {
|
|
6130
|
+
this.robots = await fetchRobotsRules(new URL(finalTargetUrl).origin, { userAgent: withSchnelltestUserAgent(void 0) });
|
|
6131
|
+
if (!this.robots.allows(finalTargetUrl) || !this.robots.allows(config.targetUrl)) {
|
|
6132
|
+
throw new Error(
|
|
6133
|
+
`Die robots.txt von ${new URL(finalTargetUrl).host} sperrt die Startseite f\xFCr automatische Besucher (cpcg). Der Schnelltest respektiert das und pr\xFCft die Seite nicht.`
|
|
5754
6134
|
);
|
|
5755
6135
|
}
|
|
5756
6136
|
}
|
|
@@ -5768,6 +6148,7 @@ var ChaosScanner = class {
|
|
|
5768
6148
|
});
|
|
5769
6149
|
this.browserVersion = `chromium ${browser.version()}`;
|
|
5770
6150
|
this.userAgent = browserUserAgent(browser.version());
|
|
6151
|
+
if (this.schnelltest) this.userAgent = withSchnelltestUserAgent(this.userAgent);
|
|
5771
6152
|
const scanBrowser = browser;
|
|
5772
6153
|
if (config.visitor === "eu" || config.proxy) {
|
|
5773
6154
|
await this.boundedStep("Messung IP-Land", preStepDeadlineMs(config), () => this.measureIpCountry(scanBrowser, config));
|
|
@@ -5791,6 +6172,7 @@ var ChaosScanner = class {
|
|
|
5791
6172
|
ctx.log(`pre-consent-leak-on-load(${_captured.length})`);
|
|
5792
6173
|
}
|
|
5793
6174
|
const rejectClick = (timeoutMs) => ctx.click(ctx.session.reject, timeoutMs, async () => {
|
|
6175
|
+
await this.measureProminence(page, ctx).catch(() => void 0);
|
|
5794
6176
|
const early = await ctx.checkTrackingCookies("pre-consent");
|
|
5795
6177
|
if (early > 0) ctx.log(`tracking-cookies-before-decision(${early})`);
|
|
5796
6178
|
const previous = ctx.getPhase();
|
|
@@ -5814,6 +6196,7 @@ var ChaosScanner = class {
|
|
|
5814
6196
|
const verdict = await this.assessMissingReject(page, ctx, config, scope, _captured, rejectClick, asReject);
|
|
5815
6197
|
if (verdict === "violation") return false;
|
|
5816
6198
|
if (verdict === "unknown") return "not-checkable";
|
|
6199
|
+
this.rejectOnlySecondLevel = true;
|
|
5817
6200
|
denied = true;
|
|
5818
6201
|
}
|
|
5819
6202
|
ctx.log("click:reject");
|
|
@@ -5872,7 +6255,7 @@ var ChaosScanner = class {
|
|
|
5872
6255
|
await ctx.snapshotBefore();
|
|
5873
6256
|
await page.waitForSelector("a[href]", { timeout: 2e3 }).catch(() => {
|
|
5874
6257
|
});
|
|
5875
|
-
const clicked = await clickFirstSameOriginLink(page, scope);
|
|
6258
|
+
const clicked = await clickFirstSameOriginLink(page, scope, this.robotsAllow);
|
|
5876
6259
|
ctx.log(clicked ? "click:same-origin-link" : "click:link-missing");
|
|
5877
6260
|
if (clicked) await page.waitForTimeout(500);
|
|
5878
6261
|
await ctx.checkTrackingCookies("pre-consent");
|
|
@@ -6244,6 +6627,7 @@ var ChaosScanner = class {
|
|
|
6244
6627
|
for (const file of this.harFiles) await redactHarHeaders(file, names2);
|
|
6245
6628
|
}
|
|
6246
6629
|
}
|
|
6630
|
+
this.appendBannerFindings(violations, config);
|
|
6247
6631
|
await this.applyScopeVerdicts(evidence, passedScenarios, failedScenarios);
|
|
6248
6632
|
this.reconcileEmbedFindings(evidence, violations, passedScenarios, failedScenarios);
|
|
6249
6633
|
this.annotateAdvisory(evidence);
|
|
@@ -6262,7 +6646,7 @@ var ChaosScanner = class {
|
|
|
6262
6646
|
...this.visitorInfo ? { visitor: { ...this.visitorInfo, ...this.visitorInfo.proxy ? { proxyRequests: this.proxyRequests, proxyRefused: this.proxyRefused } : {} } } : {},
|
|
6263
6647
|
...this.harFiles.length ? {
|
|
6264
6648
|
harFiles: this.harFiles.map(
|
|
6265
|
-
(f) =>
|
|
6649
|
+
(f) => path6.relative(path6.dirname(path6.resolve(config.reportOutput)), f).split(path6.sep).join("/")
|
|
6266
6650
|
)
|
|
6267
6651
|
} : {},
|
|
6268
6652
|
durationMs,
|
|
@@ -6563,18 +6947,19 @@ var ChaosScanner = class {
|
|
|
6563
6947
|
}
|
|
6564
6948
|
}
|
|
6565
6949
|
async newContext(browser, options = {}, opts = {}) {
|
|
6566
|
-
const harPath = this.harDir && opts.har !== false ?
|
|
6950
|
+
const harPath = this.harDir && opts.har !== false ? path6.join(this.harDir, `context-${String(++this.harCount).padStart(3, "0")}.har`) : void 0;
|
|
6567
6951
|
if (harPath) this.harFiles.push(harPath);
|
|
6568
6952
|
const har = harPath ? { recordHar: { path: harPath, content: "omit" } } : {};
|
|
6569
|
-
const
|
|
6953
|
+
const baseUserAgent = options.userAgent ?? this.userAgent ?? browserUserAgent(browser.version());
|
|
6954
|
+
const userAgent = this.schnelltest ? withSchnelltestUserAgent(baseUserAgent) : baseUserAgent;
|
|
6570
6955
|
const visitor = { locale: this.visitorProfile.locale, timezoneId: this.visitorProfile.timezoneId };
|
|
6571
|
-
const context = await browser.newContext({ serviceWorkers: "block", ...har, ...visitor, ...userAgent ? { userAgent } : {}
|
|
6956
|
+
const context = await browser.newContext({ serviceWorkers: "block", ...har, ...visitor, ...options, ...userAgent ? { userAgent } : {} });
|
|
6572
6957
|
this.liveContexts.add(context);
|
|
6573
6958
|
context.once("close", () => this.liveContexts.delete(context));
|
|
6574
6959
|
onFrameQueryTimeout(context, () => {
|
|
6575
6960
|
this.frameQueryTimeouts++;
|
|
6576
6961
|
});
|
|
6577
|
-
await trackServiceWorkers(context);
|
|
6962
|
+
await trackServiceWorkers(context, this.schnelltest ? withSchnelltestUserAgent(void 0) : void 0);
|
|
6578
6963
|
if (this.visitorInfo?.proxy) {
|
|
6579
6964
|
context.on("request", () => {
|
|
6580
6965
|
this.proxyRequests++;
|
|
@@ -6799,6 +7184,7 @@ var ChaosScanner = class {
|
|
|
6799
7184
|
* Fehlermeldungen nennen die konfigurierte Ursprungs-URL, nicht nur das Weiterleitungsziel.
|
|
6800
7185
|
*/
|
|
6801
7186
|
async gotoTarget(page, config, scope, waitUntil = "domcontentloaded", options = {}) {
|
|
7187
|
+
if (this.schnelltest && this.botProtection) throw new BotProtectionError(this.botProtection);
|
|
6802
7188
|
let status = null;
|
|
6803
7189
|
let response = null;
|
|
6804
7190
|
try {
|
|
@@ -6813,7 +7199,7 @@ var ChaosScanner = class {
|
|
|
6813
7199
|
});
|
|
6814
7200
|
}
|
|
6815
7201
|
scope.add(page.url());
|
|
6816
|
-
await this.checkBotProtection(page, response, { probe: options.probe === true, commit: waitUntil === "commit" });
|
|
7202
|
+
await this.checkBotProtection(page, response, { probe: options.probe === true, commit: waitUntil === "commit" }, config.targetUrl);
|
|
6817
7203
|
return status;
|
|
6818
7204
|
}
|
|
6819
7205
|
/**
|
|
@@ -6824,7 +7210,7 @@ var ChaosScanner = class {
|
|
|
6824
7210
|
* - Vorabprüfungen (`probe`) brechen ab, setzen den Bot-Schutz des Laufs aber nicht.
|
|
6825
7211
|
* - Fast-Click (`commit`): das Dokument ist noch leer; abgebrochen wird nur, wenn der Lauf bereits als gesperrt gilt.
|
|
6826
7212
|
*/
|
|
6827
|
-
async checkBotProtection(page, response, mode) {
|
|
7213
|
+
async checkBotProtection(page, response, mode, targetUrl) {
|
|
6828
7214
|
const status = response?.status() ?? null;
|
|
6829
7215
|
const headers = response?.headers() ?? {};
|
|
6830
7216
|
if (mode.commit) {
|
|
@@ -6839,11 +7225,15 @@ var ChaosScanner = class {
|
|
|
6839
7225
|
});
|
|
6840
7226
|
const d = await Promise.race([read, timeout]);
|
|
6841
7227
|
clearTimeout(timer);
|
|
6842
|
-
return d.ok ? { ok: true, found: botProtectionFromPage(status, d.title, d.html) } : { ok: false };
|
|
7228
|
+
return d.ok ? { ok: true, found: botProtectionFromPage(status, d.title, d.html), html: d.html } : { ok: false };
|
|
6843
7229
|
};
|
|
6844
7230
|
const first = await readPage();
|
|
6845
7231
|
let state = first;
|
|
6846
|
-
if (
|
|
7232
|
+
if (this.schnelltest && !first.found && targetUrl) {
|
|
7233
|
+
const extra = schnelltestBlock({ status, finalUrl: page.url(), targetUrl, html: first.html });
|
|
7234
|
+
if (extra) first.found = extra;
|
|
7235
|
+
}
|
|
7236
|
+
if (first.found?.vendor === "Cloudflare" && !this.botProtection && !this.challengeUnsolved && !this.schnelltest) {
|
|
6847
7237
|
const deadline = Date.now() + 8e3;
|
|
6848
7238
|
while (Date.now() < deadline) {
|
|
6849
7239
|
await page.waitForTimeout(500);
|
|
@@ -6865,6 +7255,12 @@ var ChaosScanner = class {
|
|
|
6865
7255
|
* («interrupted by another navigation»), gilt der HTTP-Status der Endseite statt eines Abbruchs.
|
|
6866
7256
|
*/
|
|
6867
7257
|
async gotoSubpage(page, scope, url, timeoutMs) {
|
|
7258
|
+
if (this.schnelltest && this.subpageBlocked) return null;
|
|
7259
|
+
const resp = await this.gotoSubpageRaw(page, scope, url, timeoutMs);
|
|
7260
|
+
if (this.schnelltest && resp && [401, 402, 403, 429].includes(resp.status())) this.subpageBlocked = true;
|
|
7261
|
+
return resp;
|
|
7262
|
+
}
|
|
7263
|
+
async gotoSubpageRaw(page, scope, url, timeoutMs) {
|
|
6868
7264
|
const end = scope.beginScannerNavigation();
|
|
6869
7265
|
let lastStatus = 0;
|
|
6870
7266
|
let navSeen = () => {
|
|
@@ -7549,6 +7945,55 @@ var ChaosScanner = class {
|
|
|
7549
7945
|
return { outcome: save ? "save-only" : "opened" };
|
|
7550
7946
|
}
|
|
7551
7947
|
}
|
|
7948
|
+
/**
|
|
7949
|
+
* Gestaltung von «Akzeptieren» und «Ablehnen» auf der ersten Ebene messen (Grösse, Schrift, gefüllt oder nur Text). Nur wenn beide
|
|
7950
|
+
* Knöpfe dort stehen; sonst nichts. Einmal je Scan (der erste Messwert zählt).
|
|
7951
|
+
*/
|
|
7952
|
+
async measureProminence(page, ctx) {
|
|
7953
|
+
if (this.prominence) return;
|
|
7954
|
+
const frameHint = ctx.session.frameHint;
|
|
7955
|
+
const measure = async (selectors) => {
|
|
7956
|
+
const target = await findTarget(page, selectors, { frameHint });
|
|
7957
|
+
if (!target) return void 0;
|
|
7958
|
+
const expr = `((sel) => { const el = document.querySelector(sel); return el ? (${LOOK_FUNCTION})(el) : null; })(${JSON.stringify(target.selector)})`;
|
|
7959
|
+
const v = await target.frame.evaluate(expr).catch(() => null);
|
|
7960
|
+
return v ? v : void 0;
|
|
7961
|
+
};
|
|
7962
|
+
const accept = await measure(ctx.session.accept);
|
|
7963
|
+
const reject = await measure(ctx.session.reject);
|
|
7964
|
+
if (accept && reject) this.prominence = { accept, reject };
|
|
7965
|
+
}
|
|
7966
|
+
/**
|
|
7967
|
+
* Befunde am Banner selbst, aus dem gebildet, was die Szenarien beobachtet haben, nach allen Szenarien: so ändert sich der Status der
|
|
7968
|
+
* Abläufe nicht, und die Wirkung je Rechtsraum entscheidet `verdictFor` (EU: Ablehnen nur in den Einstellungen = Befund, sonst Hinweis;
|
|
7969
|
+
* «Ablehnen» weniger auffällig = immer Hinweis).
|
|
7970
|
+
*/
|
|
7971
|
+
appendBannerFindings(violations, config) {
|
|
7972
|
+
const make = (ruleId, description) => ({
|
|
7973
|
+
id: `happy-path-denied-${ruleId}`,
|
|
7974
|
+
scenario: "happy-path-denied",
|
|
7975
|
+
trackerName: "Consent-Banner",
|
|
7976
|
+
trackerCategory: "unknown",
|
|
7977
|
+
requestUrl: config.targetUrl,
|
|
7978
|
+
ruleId,
|
|
7979
|
+
method: "DOM",
|
|
7980
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7981
|
+
description
|
|
7982
|
+
});
|
|
7983
|
+
if (this.rejectOnlySecondLevel) {
|
|
7984
|
+
violations.push(
|
|
7985
|
+
make(
|
|
7986
|
+
"reject-second-level",
|
|
7987
|
+
"Auf der ersten Ebene des Banners gibt es kein \xABAblehnen\xBB; abgelehnt werden konnte erst \xFCber die Einstellungen (zweite Ebene), Zustimmen mit einem Klick. Messergebnis: die gleichwertige Wahl auf der ersten Ebene fehlt (relevant im Modell opt-in; in den Modellen mit Widerspruch gen\xFCgt ein Weg \xABmit wenigen Klicks\xBB). Technischer Befund, keine Rechtsbewertung."
|
|
7988
|
+
)
|
|
7989
|
+
);
|
|
7990
|
+
}
|
|
7991
|
+
const p = this.prominence;
|
|
7992
|
+
if (p && !this.rejectOnlySecondLevel) {
|
|
7993
|
+
const reasons = prominenceReasons(p.accept, p.reject);
|
|
7994
|
+
if (reasons.length > 0) violations.push(make("reject-less-prominent", prominenceDescription(p.accept, p.reject, reasons)));
|
|
7995
|
+
}
|
|
7996
|
+
}
|
|
7552
7997
|
/**
|
|
7553
7998
|
* Kein Ablehnen-Button gefunden: ist das ein Dark Pattern oder nur ein nicht erkannter Banner?
|
|
7554
7999
|
* Sehr konservativ — «Banner nicht erkannt» wird nie als Dark Pattern gemeldet. Ein Befund
|
|
@@ -7673,10 +8118,10 @@ var ChaosScanner = class {
|
|
|
7673
8118
|
}
|
|
7674
8119
|
async snap(page, scenario, label, shots, acts, actionSequence) {
|
|
7675
8120
|
if (!this.screenshots) return;
|
|
7676
|
-
const dir = this.evidenceDir ??
|
|
7677
|
-
await
|
|
8121
|
+
const dir = this.evidenceDir ?? path6.resolve("reports/evidence");
|
|
8122
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
7678
8123
|
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
7679
|
-
const file =
|
|
8124
|
+
const file = path6.join(dir, `${scenario}-${label}-${Date.now()}.jpg`);
|
|
7680
8125
|
await this.captureShot(page, file);
|
|
7681
8126
|
shots.push({ label, path: file, at: at2 });
|
|
7682
8127
|
actionSequence.push(`screenshot:${label}`);
|
|
@@ -7688,14 +8133,14 @@ var ChaosScanner = class {
|
|
|
7688
8133
|
*/
|
|
7689
8134
|
async snapViewport(page, scenario, label, shots, acts, actionSequence) {
|
|
7690
8135
|
if (!this.screenshots) return;
|
|
7691
|
-
const dir = this.evidenceDir ??
|
|
7692
|
-
await
|
|
8136
|
+
const dir = this.evidenceDir ?? path6.resolve("reports/evidence");
|
|
8137
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
7693
8138
|
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
7694
|
-
const file =
|
|
8139
|
+
const file = path6.join(dir, `${scenario}-${label}-${Date.now()}.jpg`);
|
|
7695
8140
|
const clip = await bannerClip(page);
|
|
7696
8141
|
await page.screenshot({ path: file, type: "jpeg", quality: 70, scale: "css", ...clip ? { clip } : {} }).catch(() => {
|
|
7697
8142
|
});
|
|
7698
|
-
const size = (await
|
|
8143
|
+
const size = (await fs6.stat(file).catch(() => void 0))?.size ?? 0;
|
|
7699
8144
|
if (size === 0) return;
|
|
7700
8145
|
this.evidenceBytes += size;
|
|
7701
8146
|
shots.push({ label, path: file, at: at2 });
|
|
@@ -7730,7 +8175,7 @@ var ChaosScanner = class {
|
|
|
7730
8175
|
const height = Math.max(1, Math.min(dims.h || 720, step.height));
|
|
7731
8176
|
await page.screenshot({ path: file, type: "jpeg", quality: step.quality, scale: "css", fullPage: true, clip: { x: 0, y: 0, width, height } }).catch(() => {
|
|
7732
8177
|
});
|
|
7733
|
-
size = (await
|
|
8178
|
+
size = (await fs6.stat(file).catch(() => void 0))?.size ?? 0;
|
|
7734
8179
|
if (size <= SHOT_MAX_BYTES) break;
|
|
7735
8180
|
}
|
|
7736
8181
|
this.evidenceBytes += size;
|
|
@@ -8062,7 +8507,7 @@ var ChaosScanner = class {
|
|
|
8062
8507
|
await page.reload({ waitUntil: "domcontentloaded", timeout: config.timeoutMs });
|
|
8063
8508
|
actionSequence.push("reload");
|
|
8064
8509
|
await page.waitForTimeout(500);
|
|
8065
|
-
const links = await collectSameOriginLinks(page, scope, PERSISTENCE_SUBPAGES + 2);
|
|
8510
|
+
const links = await collectSameOriginLinks(page, scope, PERSISTENCE_SUBPAGES + 2, this.robotsAllow);
|
|
8066
8511
|
const reachedSubpages = [];
|
|
8067
8512
|
const askedAgainOn = [];
|
|
8068
8513
|
for (const link of links) {
|
|
@@ -8903,7 +9348,7 @@ var ChaosScanner = class {
|
|
|
8903
9348
|
this.logAct(actionTimeline, actionSequence, "goto:root");
|
|
8904
9349
|
armed = true;
|
|
8905
9350
|
const storageBefore = await this.snapshotStorage(page);
|
|
8906
|
-
const sample = await collectLinkSample(page, scope, config.sitemap ? DEEP_MAX_CANDIDATES : this.maxSubpages);
|
|
9351
|
+
const sample = await collectLinkSample(page, scope, config.sitemap ? DEEP_MAX_CANDIDATES : this.maxSubpages, this.robotsAllow);
|
|
8907
9352
|
const deep = config.sitemap ? await this.prepareDeepRun(config, scope, sample.picked) : void 0;
|
|
8908
9353
|
const recheck = (config.recheckPaths ?? []).map((p) => new URL(p, config.targetUrl).href);
|
|
8909
9354
|
const base = deep ? deep.pending : sample.picked;
|
|
@@ -8922,6 +9367,10 @@ var ChaosScanner = class {
|
|
|
8922
9367
|
let budgetExhausted = false;
|
|
8923
9368
|
const subpageDeadline = Date.now() + (deep ? config.deepBudgetSeconds * 1e3 : subpageBudgetMs(this.maxSubpages));
|
|
8924
9369
|
for (const link of links) {
|
|
9370
|
+
if (this.schnelltest && this.subpageBlocked) {
|
|
9371
|
+
this.logAct(actionTimeline, actionSequence, "subpages:blocked-stop");
|
|
9372
|
+
break;
|
|
9373
|
+
}
|
|
8925
9374
|
const remaining = subpageDeadline - Date.now();
|
|
8926
9375
|
if (remaining <= 0) {
|
|
8927
9376
|
budgetExhausted = true;
|
|
@@ -8946,6 +9395,7 @@ var ChaosScanner = class {
|
|
|
8946
9395
|
let spaNavigations = 0;
|
|
8947
9396
|
let spaSkipped = 0;
|
|
8948
9397
|
for (const link of links.slice(0, 3)) {
|
|
9398
|
+
if (this.schnelltest && this.subpageBlocked) break;
|
|
8949
9399
|
try {
|
|
8950
9400
|
await this.gotoTarget(page, config, scope);
|
|
8951
9401
|
} catch (err) {
|
|
@@ -9272,7 +9722,7 @@ var ChaosScanner = class {
|
|
|
9272
9722
|
await page.waitForTimeout(300);
|
|
9273
9723
|
const observationMs = 2e3;
|
|
9274
9724
|
let navigated = false;
|
|
9275
|
-
for (const link of await collectSameOriginLinks(page, scope, 3)) {
|
|
9725
|
+
for (const link of await collectSameOriginLinks(page, scope, 3, this.robotsAllow)) {
|
|
9276
9726
|
const resp = await this.gotoSubpage(page, scope, link, config.timeoutMs).catch(() => null);
|
|
9277
9727
|
const httpStatus = resp?.status() ?? 0;
|
|
9278
9728
|
this.logAct(actionTimeline, actionSequence, `post-revoke:goto ${new URL(link).pathname} -> ${httpStatus || "error"}`);
|
|
@@ -9394,7 +9844,7 @@ function verifyTrialToken(token, publicKey = defaultPublicKey(), nowMs = Date.no
|
|
|
9394
9844
|
if (c.exp * 1e3 < nowMs) return { ok: false, reason: "expired" };
|
|
9395
9845
|
return { ok: true, claims: { tier: "trial", exp: c.exp, id: c.id } };
|
|
9396
9846
|
}
|
|
9397
|
-
var TRIAL_EXIT_TOKEN = "CPCG-T-
|
|
9847
|
+
var TRIAL_EXIT_TOKEN = "CPCG-T-eyJ0aWVyIjoidHJpYWwiLCJleHAiOjE4MDIxMDQyNTksImlkIjoicGFrZXQtMC40LjEifQ.CN5o41wv5OSBRldRXHwUzIRMnrRc5Qgwkv06SmWS9A6gPOuLfE9Oawz0G9uxmbm1NmS9FlR8GUxcVkJhFiWGDA";
|
|
9398
9848
|
function trialCredential(nowMs = Date.now(), publicKey = LICENSE_PUBLIC_KEY) {
|
|
9399
9849
|
return verifyTrialToken(TRIAL_EXIT_TOKEN, publicKey, nowMs).ok ? TRIAL_EXIT_TOKEN : void 0;
|
|
9400
9850
|
}
|
|
@@ -9544,8 +9994,8 @@ function combineVisits(ch, eu, missing, policy) {
|
|
|
9544
9994
|
}
|
|
9545
9995
|
|
|
9546
9996
|
// src/core/remediation/index.ts
|
|
9547
|
-
import
|
|
9548
|
-
import
|
|
9997
|
+
import fs8 from "fs/promises";
|
|
9998
|
+
import path8 from "path";
|
|
9549
9999
|
import { execFile as execFile2 } from "child_process";
|
|
9550
10000
|
import { promisify as promisify2 } from "util";
|
|
9551
10001
|
|
|
@@ -9553,7 +10003,7 @@ import { promisify as promisify2 } from "util";
|
|
|
9553
10003
|
import ts2 from "typescript";
|
|
9554
10004
|
|
|
9555
10005
|
// src/core/legal/disclaimer.ts
|
|
9556
|
-
var LEGAL_DISCLAIMER = "\u26A0\uFE0F **Hinweis / Disclaimer:** CPCG ist ein technisches Hilfsmittel zur Unterst\xFCtzung bei der Implementierung von Consent-L\xF6sungen \u2014 **keine Rechtsberatung** und keine Garantie f\xFCr DSGVO-/TTDSG-Konformit\xE4t. Bitte
|
|
10006
|
+
var LEGAL_DISCLAIMER = "\u26A0\uFE0F **Hinweis / Disclaimer:** CPCG ist ein technisches Hilfsmittel zur Unterst\xFCtzung bei der Implementierung von Consent-L\xF6sungen \u2014 **keine Rechtsberatung** und keine Garantie f\xFCr DSGVO-/TTDSG-Konformit\xE4t. Bitte lass die endg\xFCltige Umsetzung anwaltlich pr\xFCfen. / CPCG is a technical aid, **not legal advice** and no guarantee of GDPR/ePrivacy compliance. Have the final implementation reviewed by counsel.";
|
|
9557
10007
|
|
|
9558
10008
|
// src/core/remediation/scripts.ts
|
|
9559
10009
|
import ts from "typescript";
|
|
@@ -10283,8 +10733,8 @@ var CodeReviewer = class {
|
|
|
10283
10733
|
|
|
10284
10734
|
// src/core/remediation/pullRequest.ts
|
|
10285
10735
|
import { execFile } from "child_process";
|
|
10286
|
-
import
|
|
10287
|
-
import
|
|
10736
|
+
import fs7 from "fs/promises";
|
|
10737
|
+
import path7 from "path";
|
|
10288
10738
|
import { promisify } from "util";
|
|
10289
10739
|
var execFileAsync = promisify(execFile);
|
|
10290
10740
|
var BRANCH_PREFIX_RE = /^[A-Za-z0-9._/-]+$/;
|
|
@@ -10306,27 +10756,27 @@ function redactSecrets2(text, token) {
|
|
|
10306
10756
|
}
|
|
10307
10757
|
async function gitRootOf(dir) {
|
|
10308
10758
|
try {
|
|
10309
|
-
const { stdout } = await execFileAsync("git", ["-C",
|
|
10759
|
+
const { stdout } = await execFileAsync("git", ["-C", path7.resolve(dir), "rev-parse", "--show-toplevel"], {
|
|
10310
10760
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
10311
10761
|
});
|
|
10312
10762
|
const root = stdout.trim();
|
|
10313
10763
|
if (!root) return void 0;
|
|
10314
|
-
return await
|
|
10764
|
+
return await fs7.realpath(path7.normalize(root)).catch(() => path7.normalize(root));
|
|
10315
10765
|
} catch {
|
|
10316
10766
|
return void 0;
|
|
10317
10767
|
}
|
|
10318
10768
|
}
|
|
10319
10769
|
async function gitRootForPatches(sourceDir, files) {
|
|
10320
10770
|
for (const f of files) {
|
|
10321
|
-
const root = await gitRootOf(
|
|
10771
|
+
const root = await gitRootOf(path7.dirname(path7.resolve(f)));
|
|
10322
10772
|
if (root) return root;
|
|
10323
10773
|
}
|
|
10324
10774
|
return gitRootOf(sourceDir);
|
|
10325
10775
|
}
|
|
10326
10776
|
async function repoRelative(root, file) {
|
|
10327
|
-
const abs =
|
|
10328
|
-
const dir = await
|
|
10329
|
-
return
|
|
10777
|
+
const abs = path7.resolve(file);
|
|
10778
|
+
const dir = await fs7.realpath(path7.dirname(abs)).catch(() => path7.dirname(abs));
|
|
10779
|
+
return path7.relative(root, path7.join(dir, path7.basename(abs))).split(path7.sep).join("/");
|
|
10330
10780
|
}
|
|
10331
10781
|
function parseGitHubRepo(url) {
|
|
10332
10782
|
if (!url) return null;
|
|
@@ -10435,7 +10885,7 @@ var PullRequestEngine = class {
|
|
|
10435
10885
|
validateBranchPrefix(config.branchPrefix);
|
|
10436
10886
|
const root = await gitRootForPatches(config.sourceDir, patches.map((p) => p.filePath));
|
|
10437
10887
|
if (!root) {
|
|
10438
|
-
throw new Error(`--git-commit/--create-pr: ${
|
|
10888
|
+
throw new Error(`--git-commit/--create-pr: ${path7.resolve(config.sourceDir)} liegt in keinem Git-Repository`);
|
|
10439
10889
|
}
|
|
10440
10890
|
const run = (args, token, env) => this.git(args, token, env, root);
|
|
10441
10891
|
const startBranch = await run(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
@@ -11133,7 +11583,7 @@ var RemediationEngine = class {
|
|
|
11133
11583
|
return failure(report, error, "unpatched", "kein Quelltext im sourceDir gefunden (--source-dir pr\xFCfen)");
|
|
11134
11584
|
}
|
|
11135
11585
|
const contents = /* @__PURE__ */ new Map();
|
|
11136
|
-
for (const f of candidateFiles) contents.set(f, await
|
|
11586
|
+
for (const f of candidateFiles) contents.set(f, await fs8.readFile(f, "utf-8"));
|
|
11137
11587
|
const cmp = detectCmps([...contents.values()]);
|
|
11138
11588
|
const blocker = cmpBlocker(cmp);
|
|
11139
11589
|
if (!config.allowCustomBannerFix && report.bannerKind !== "supported-cmp") {
|
|
@@ -11219,7 +11669,7 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11219
11669
|
if (wantsGit) {
|
|
11220
11670
|
repoRoot = await gitRootForPatches(config.sourceDir, approvedPatches.map((p) => p.filePath));
|
|
11221
11671
|
if (!repoRoot) {
|
|
11222
|
-
gitNote = `--git-commit/--create-pr: ${
|
|
11672
|
+
gitNote = `--git-commit/--create-pr: ${path8.resolve(config.sourceDir)} liegt in keinem Git-Repository \u2014 der Fix wurde lokal angewendet, aber nicht committet und kein PR erstellt (Fix nicht verifiziert).`;
|
|
11223
11673
|
}
|
|
11224
11674
|
}
|
|
11225
11675
|
const gitRelFiles = repoRoot ? await Promise.all(approvedPatches.map((p) => repoRelative(repoRoot, p.filePath))) : [];
|
|
@@ -11237,11 +11687,11 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11237
11687
|
}
|
|
11238
11688
|
const originals = /* @__PURE__ */ new Map();
|
|
11239
11689
|
for (const patch of approvedPatches) {
|
|
11240
|
-
originals.set(patch.filePath, patch.originalContent ?? await
|
|
11690
|
+
originals.set(patch.filePath, patch.originalContent ?? await fs8.readFile(patch.filePath, "utf-8"));
|
|
11241
11691
|
}
|
|
11242
11692
|
const rollback = async () => {
|
|
11243
11693
|
for (const [file, content] of originals) {
|
|
11244
|
-
await
|
|
11694
|
+
await fs8.writeFile(file, content, "utf-8").catch(() => void 0);
|
|
11245
11695
|
}
|
|
11246
11696
|
};
|
|
11247
11697
|
let commitHash;
|
|
@@ -11256,7 +11706,7 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11256
11706
|
let gitPhase = false;
|
|
11257
11707
|
try {
|
|
11258
11708
|
for (const patch of approvedPatches) {
|
|
11259
|
-
await
|
|
11709
|
+
await fs8.writeFile(patch.filePath, patch.patchedContent, "utf-8");
|
|
11260
11710
|
}
|
|
11261
11711
|
gitPhase = true;
|
|
11262
11712
|
if (config.createPr && repoRoot) {
|
|
@@ -11321,20 +11771,20 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11321
11771
|
const candidates = [];
|
|
11322
11772
|
const allowedExtensions = /* @__PURE__ */ new Set([".html", ".htm", ".jsx", ".tsx", ".js", ".ts", ".vue", ".svelte"]);
|
|
11323
11773
|
async function walk(currentDir) {
|
|
11324
|
-
const entries = await
|
|
11774
|
+
const entries = await fs8.readdir(currentDir, { withFileTypes: true }).catch(() => []);
|
|
11325
11775
|
for (const entry of entries) {
|
|
11326
|
-
const fullPath =
|
|
11776
|
+
const fullPath = path8.join(currentDir, entry.name);
|
|
11327
11777
|
if (entry.isDirectory()) {
|
|
11328
11778
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist" || entry.name === "reports" || entry.name === "test-fixtures" || entry.name === "tests") {
|
|
11329
11779
|
continue;
|
|
11330
11780
|
}
|
|
11331
11781
|
await walk(fullPath);
|
|
11332
|
-
} else if (entry.isFile() && allowedExtensions.has(
|
|
11782
|
+
} else if (entry.isFile() && allowedExtensions.has(path8.extname(entry.name).toLowerCase())) {
|
|
11333
11783
|
candidates.push(fullPath);
|
|
11334
11784
|
}
|
|
11335
11785
|
}
|
|
11336
11786
|
}
|
|
11337
|
-
await walk(
|
|
11787
|
+
await walk(path8.resolve(dir));
|
|
11338
11788
|
return candidates;
|
|
11339
11789
|
}
|
|
11340
11790
|
/**
|
|
@@ -11445,18 +11895,18 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11445
11895
|
* (no path traversal / arbitrary writes) and fill originalContent from disk for the Review Agent.
|
|
11446
11896
|
*/
|
|
11447
11897
|
async sanitizeLlmPatches(raw, candidateFiles) {
|
|
11448
|
-
const allowed = new Map(candidateFiles.map((f) => [
|
|
11898
|
+
const allowed = new Map(candidateFiles.map((f) => [path8.resolve(f), f]));
|
|
11449
11899
|
const result = [];
|
|
11450
11900
|
for (const item of raw) {
|
|
11451
11901
|
const parsed = FilePatchSchema.safeParse(item);
|
|
11452
11902
|
if (!parsed.success) continue;
|
|
11453
|
-
const resolved =
|
|
11903
|
+
const resolved = path8.resolve(parsed.data.filePath);
|
|
11454
11904
|
const known2 = allowed.get(resolved);
|
|
11455
11905
|
if (!known2) {
|
|
11456
11906
|
console.warn(`\u26A0 Ignoring LLM patch for unknown/out-of-scope file: ${parsed.data.filePath}`);
|
|
11457
11907
|
continue;
|
|
11458
11908
|
}
|
|
11459
|
-
const originalContent = await
|
|
11909
|
+
const originalContent = await fs8.readFile(known2, "utf-8");
|
|
11460
11910
|
result.push({ ...parsed.data, filePath: known2, originalContent });
|
|
11461
11911
|
}
|
|
11462
11912
|
return result;
|
|
@@ -11464,8 +11914,8 @@ ${reviewVerdict.comments.join("\n")}`,
|
|
|
11464
11914
|
};
|
|
11465
11915
|
|
|
11466
11916
|
// src/core/report/evidenceReport.ts
|
|
11467
|
-
import
|
|
11468
|
-
import
|
|
11917
|
+
import fs9 from "fs";
|
|
11918
|
+
import path9 from "path";
|
|
11469
11919
|
function statusLabelOf(s) {
|
|
11470
11920
|
return s === "passed" ? "bestanden" : s === "suspicious" ? "auff\xE4llig" : s === "not-applicable" ? "nicht anwendbar" : "nicht pr\xFCfbar";
|
|
11471
11921
|
}
|
|
@@ -11473,9 +11923,9 @@ function evidenceLabelOf(e) {
|
|
|
11473
11923
|
return statusLabelOf(e.status) + (e.status === "passed" && (e.ignoredFindings ?? 0) > 0 ? " (Befunde ignoriert)" : "");
|
|
11474
11924
|
}
|
|
11475
11925
|
var PH = {
|
|
11476
|
-
GA4: { name: "{{GA4_MESS_ID}}", meaning: "
|
|
11477
|
-
CMP_EVENT: { name: "{{CMP_EREIGNIS}}", meaning: "Ereignis bzw. Callback
|
|
11478
|
-
CMP_STATE: { name: "{{CMP_STATUS}}", meaning: "Ausdruck f\xFCr das Objekt, in dem
|
|
11926
|
+
GA4: { name: "{{GA4_MESS_ID}}", meaning: "Deine GA4-Mess-ID (beginnt mit G-)" },
|
|
11927
|
+
CMP_EVENT: { name: "{{CMP_EREIGNIS}}", meaning: "Ereignis bzw. Callback deiner CMP, wenn eine Einwilligung erteilt wird" },
|
|
11928
|
+
CMP_STATE: { name: "{{CMP_STATUS}}", meaning: "Ausdruck f\xFCr das Objekt, in dem deine CMP die erteilten Kategorien f\xFChrt (z. B. window.meineCmp.consent)" },
|
|
11479
11929
|
VIDEO: { name: "{{VIDEO_ID}}", meaning: "ID des eingebetteten Videos" },
|
|
11480
11930
|
PATHS: { name: "{{COOKIE_PFADE}}", meaning: "Pfade der Tracker-Cookies laut Scan, als JS-Liste, z. B. ['/', '/shop']" },
|
|
11481
11931
|
COOKIES: { name: "{{TRACKER_COOKIES}}", meaning: "Namen der Tracker-Cookies aus dem Scan, als JS-Liste, z. B. ['_ga', '_fbp']" }
|
|
@@ -11816,7 +12266,7 @@ function problemsTextOf(n) {
|
|
|
11816
12266
|
function reproductionText(count) {
|
|
11817
12267
|
return count === 1 ? "1 Request" : `${count} Requests`;
|
|
11818
12268
|
}
|
|
11819
|
-
function buildEvidenceMarkdown(report, title = "
|
|
12269
|
+
function buildEvidenceMarkdown(report, title = "Nachweis-Bericht", options = {}) {
|
|
11820
12270
|
const evidence = report.evidence ?? [];
|
|
11821
12271
|
const demoLine = options.demo ? "> **Demo-Report** \xB7 synthetische Testdaten \u2014 keine realen Kundendaten.\n\n" : "";
|
|
11822
12272
|
const facts = deriveReportFacts(report, options.gate);
|
|
@@ -11968,7 +12418,7 @@ function buildEvidenceMarkdown(report, title = "Evidence Report", options = {})
|
|
|
11968
12418
|
if (!e.screenshots?.length && !e.screenshotPath) continue;
|
|
11969
12419
|
lines.push(`### ${escapeMarkdownText(e.scenario)}`, "");
|
|
11970
12420
|
for (const s of e.screenshots ?? []) {
|
|
11971
|
-
lines.push(`- **${escapeMarkdownText(s.label)}** (${escapeMarkdownText(s.at)}): \`evidence/${escapeCell(
|
|
12421
|
+
lines.push(`- **${escapeMarkdownText(s.label)}** (${escapeMarkdownText(s.at)}): \`evidence/${escapeCell(path9.win32.basename(s.path))}\``);
|
|
11972
12422
|
}
|
|
11973
12423
|
if (e.storageAfter?.cookies?.length) {
|
|
11974
12424
|
lines.push(`- Cookies nachher: ${escapeMarkdownText(e.storageAfter.cookies.slice(0, 8).join(", "))}`);
|
|
@@ -12018,16 +12468,16 @@ function shotSrc(p, shotSources) {
|
|
|
12018
12468
|
const web = shotSources?.get(p);
|
|
12019
12469
|
if (web) return web;
|
|
12020
12470
|
try {
|
|
12021
|
-
if (
|
|
12022
|
-
const buf =
|
|
12023
|
-
const ext =
|
|
12471
|
+
if (fs9.statSync(p).size > MAX_RAW_EMBED_BYTES) return "";
|
|
12472
|
+
const buf = fs9.readFileSync(p);
|
|
12473
|
+
const ext = path9.extname(p).toLowerCase().replace(".", "");
|
|
12024
12474
|
const mime = ext === "jpg" ? "jpeg" : ext === "jpeg" ? "jpeg" : "png";
|
|
12025
12475
|
return `data:image/${mime};base64,${buf.toString("base64")}`;
|
|
12026
12476
|
} catch {
|
|
12027
12477
|
return "";
|
|
12028
12478
|
}
|
|
12029
12479
|
}
|
|
12030
|
-
function buildEvidenceHtml(report, title = "
|
|
12480
|
+
function buildEvidenceHtml(report, title = "Nachweis-Bericht", options = {}) {
|
|
12031
12481
|
const evidence = report.evidence ?? [];
|
|
12032
12482
|
const facts = deriveReportFacts(report, options.gate);
|
|
12033
12483
|
const strict = options.gate?.strict === true;
|
|
@@ -12080,6 +12530,8 @@ function buildEvidenceHtml(report, title = "Evidence Report", options = {}) {
|
|
|
12080
12530
|
"consent-mode-mismatch": "Consent-Mode-Zustand deckt sich mit Verhalten",
|
|
12081
12531
|
"tcf-consent-mismatch": "IAB-TCF-String meldet nach Ablehnen keine Zustimmung",
|
|
12082
12532
|
"no-reject-option": "Ablehnen ist gleichwertig zu Akzeptieren m\xF6glich",
|
|
12533
|
+
"reject-second-level": "Ablehnen ist auf der ersten Ebene des Banners m\xF6glich",
|
|
12534
|
+
"reject-less-prominent": "Ablehnen ist gleich auff\xE4llig gestaltet wie Akzeptieren",
|
|
12083
12535
|
"no-consent-choice": "Der Banner bietet eine Auswahl (Akzeptieren oder Ablehnen)",
|
|
12084
12536
|
"gpc-ignored": "Global Privacy Control (GPC) wird als Opt-out beachtet"
|
|
12085
12537
|
};
|
|
@@ -12180,7 +12632,7 @@ function buildEvidenceHtml(report, title = "Evidence Report", options = {}) {
|
|
|
12180
12632
|
const shots = e.screenshots ?? (e.screenshotPath ? [{ label: "Screenshot", path: e.screenshotPath, at: e.checkedAt }] : []);
|
|
12181
12633
|
const gallery = shots.length ? `<div class="shots">${shots.map((s) => {
|
|
12182
12634
|
const src = shotSrc(s.path, options.shotSources);
|
|
12183
|
-
const media = src ? `<img class="shot" src="${src}" alt="${esc2(s.label)}" loading="lazy">` : `<code class="shot-path">evidence/${esc2(
|
|
12635
|
+
const media = src ? `<img class="shot" src="${src}" alt="${esc2(s.label)}" loading="lazy">` : `<code class="shot-path">evidence/${esc2(path9.win32.basename(s.path))}</code>`;
|
|
12184
12636
|
return `<figure>
|
|
12185
12637
|
<figcaption><span class="shot-label">${esc2(s.label)}</span>
|
|
12186
12638
|
<span class="ts">${esc2(fmtTime(s.at))}</span></figcaption>
|
|
@@ -12591,7 +13043,7 @@ ${demoBanner}
|
|
|
12591
13043
|
</div>
|
|
12592
13044
|
</header>
|
|
12593
13045
|
<main>
|
|
12594
|
-
<h2><span class="num">01</span>
|
|
13046
|
+
<h2><span class="num">01</span>Zusammenfassung</h2>
|
|
12595
13047
|
<p class="sub">Ausschliesslich abgeleitet aus den tats\xE4chlich ausgef\xFChrten Szenarien dieses Scans.</p>
|
|
12596
13048
|
<div id="summary">${summaryHtml}</div>
|
|
12597
13049
|
<div class="kpis">
|
|
@@ -12601,7 +13053,7 @@ ${demoBanner}
|
|
|
12601
13053
|
<div class="note"><strong>Hinweis:</strong> Technisches Hilfsmittel, keine Rechtsberatung. / Technical aid, not legal advice. Die Schweregrad-Einstufung je Rechtsraum ist eine technisch-juristische Einordnungshilfe und ersetzt keine Beratung.</div>
|
|
12602
13054
|
${warningsHtml}
|
|
12603
13055
|
|
|
12604
|
-
<h2><span class="num">02</span>
|
|
13056
|
+
<h2><span class="num">02</span>Rechtsr\xE4ume</h2>
|
|
12605
13057
|
<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>
|
|
12606
13058
|
<div class="jgrid">
|
|
12607
13059
|
${jCards}
|
|
@@ -12706,8 +13158,8 @@ ${demoBanner}
|
|
|
12706
13158
|
}
|
|
12707
13159
|
|
|
12708
13160
|
// src/core/report/customerPdf.ts
|
|
12709
|
-
import
|
|
12710
|
-
import
|
|
13161
|
+
import path10 from "path";
|
|
13162
|
+
import fs10 from "fs/promises";
|
|
12711
13163
|
async function renderCustomerPdf(html, outPath, footerTemplate) {
|
|
12712
13164
|
const { chromium: chromium2 } = await import("playwright");
|
|
12713
13165
|
const browser = await chromium2.launch({ headless: true });
|
|
@@ -12726,8 +13178,8 @@ async function renderCustomerPdf(html, outPath, footerTemplate) {
|
|
|
12726
13178
|
headerTemplate: "<div></div>",
|
|
12727
13179
|
footerTemplate
|
|
12728
13180
|
});
|
|
12729
|
-
await
|
|
12730
|
-
await
|
|
13181
|
+
await fs10.mkdir(path10.dirname(outPath), { recursive: true });
|
|
13182
|
+
await fs10.writeFile(outPath, pdf);
|
|
12731
13183
|
return outPath;
|
|
12732
13184
|
} finally {
|
|
12733
13185
|
await browser.close().catch(() => {
|
|
@@ -12740,7 +13192,23 @@ function hardenReportHtml(html) {
|
|
|
12740
13192
|
return /<head[^>]*>/i.test(html) ? html.replace(/<head[^>]*>/i, (m) => `${m}${meta}`) : `${meta}${html}`;
|
|
12741
13193
|
}
|
|
12742
13194
|
|
|
13195
|
+
// src/core/report/limitedPdf.ts
|
|
13196
|
+
import { createHash as createHash2 } from "crypto";
|
|
13197
|
+
|
|
12743
13198
|
// src/core/license/limitedOutput.ts
|
|
13199
|
+
var AFTER_REJECT_RULES = /* @__PURE__ */ new Set(["tracking-after-deny", "tcf-consent-mismatch"]);
|
|
13200
|
+
var BEFORE_CHOICE_RULES = /* @__PURE__ */ new Set(["pre-consent-tracking", "pre-consent-embed"]);
|
|
13201
|
+
function rejectWorksOf(blocking, evidence) {
|
|
13202
|
+
if (blocking.some((v) => v.ruleId && AFTER_REJECT_RULES.has(v.ruleId))) return "no";
|
|
13203
|
+
const clicked = (evidence ?? []).some(
|
|
13204
|
+
(e) => (e.scenario === "happy-path-denied" || e.scenario === "consent-persistence") && e.actionSequence.some((a) => a.startsWith("click:reject") && a !== "click:reject-missing")
|
|
13205
|
+
);
|
|
13206
|
+
return clicked ? "yes" : "unknown";
|
|
13207
|
+
}
|
|
13208
|
+
function preSelectionOf(blocking) {
|
|
13209
|
+
const pre = blocking.filter((v) => v.ruleId && BEFORE_CHOICE_RULES.has(v.ruleId));
|
|
13210
|
+
return { requests: pre.length, scenarios: new Set(pre.map((v) => v.scenario)).size };
|
|
13211
|
+
}
|
|
12744
13212
|
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
12745
13213
|
function limitedHeadline(f) {
|
|
12746
13214
|
if (f.state === "clean") {
|
|
@@ -12753,7 +13221,7 @@ function limitedReason(f) {
|
|
|
12753
13221
|
if (f.reason === "unreachable") {
|
|
12754
13222
|
return "Der Lizenzdienst war nicht erreichbar, und es liegt keine g\xFCltige Offline-Freigabe vor. Einmal mit Netzzugang pr\xFCfen; danach gilt die Freigabe auch ohne Netz.";
|
|
12755
13223
|
}
|
|
12756
|
-
return f.reason === "invalid" ? `
|
|
13224
|
+
return f.reason === "invalid" ? `Deine Lizenz ist nicht g\xFCltig${f.detail ? `: ${f.detail.replace(/^✖\s*/, "").replace(/^Lizenz ungültig:\s*/i, "").replace(/\.$/, "")}` : ""}.` : "Es ist keine Lizenz hinterlegt.";
|
|
12757
13225
|
}
|
|
12758
13226
|
function limitedLines(f) {
|
|
12759
13227
|
if (f.state === "clean" && f.hints === 0) {
|
|
@@ -12833,12 +13301,12 @@ function removeStep(stack) {
|
|
|
12833
13301
|
const many = codesOf(stack).length > 1;
|
|
12834
13302
|
const idText = idLabel(stack) ? ` (${idLabel(stack)})` : "";
|
|
12835
13303
|
const tags = many ? "Die Google-Tags" : "Der Google-Tag";
|
|
12836
|
-
const head = "**Dieser Code ist heute auf
|
|
13304
|
+
const head = "**Dieser Code ist heute auf deiner Seite**";
|
|
12837
13305
|
if (stack.embeds && stack.embeds.length > 1) {
|
|
12838
13306
|
return {
|
|
12839
13307
|
who: "WordPress-Admin \xB7 ca. 10 Minuten",
|
|
12840
13308
|
title: "Den Google-Tag nur noch von einem Plugin ausgeben lassen",
|
|
12841
|
-
body: `Auf
|
|
13309
|
+
body: `Auf deiner Seite geben mehrere Plugins Google-Code aus: ${stack.embeds.map((e) => `**${e}**`).join(" und ")}${idText}. Das l\xE4uft vor der Zustimmung und kann Besuche doppelt z\xE4hlen. Nur **eines** davon darf den Tag ausgeben; bei den anderen die Analytics-Anbindung ausschalten (Einstellungen des jeweiligen Plugins). Den verbleibenden Tag danach \xFCber das Cookie-Tool laden (n\xE4chster Schritt).`,
|
|
12842
13310
|
codes: blocks(stack, head, "und l\xE4dt ohne Zustimmung")
|
|
12843
13311
|
};
|
|
12844
13312
|
}
|
|
@@ -12855,7 +13323,7 @@ function removeStep(stack) {
|
|
|
12855
13323
|
return {
|
|
12856
13324
|
who: "WordPress-Admin \xB7 ca. 5 Minuten",
|
|
12857
13325
|
title: "Google-Tag von Site Kit nicht mehr fest ausliefern",
|
|
12858
|
-
body: `${tags}${idText} ${many ? "werden" : "wird"} vom Plugin **Site Kit by Google** ausgegeben und ${many ? "laufen" : "l\xE4uft"} deshalb auf jeder Seite sofort. Zwei Wege. **A:** In Site Kit \u2192 Einstellungen \u2192 Admin-Einstellungen den **Consent Mode** einschalten (er ist standardm\xE4ssig aus; Voraussetzung ist das Plugin \xABWP Consent API\xBB und ein Cookie-Tool, das es unterst\xFCtzt). Der Tag wird dann zwar noch geladen, sendet aber ohne Einwilligung keine Messdaten und setzt keine Cookies; ob das
|
|
13326
|
+
body: `${tags}${idText} ${many ? "werden" : "wird"} vom Plugin **Site Kit by Google** ausgegeben und ${many ? "laufen" : "l\xE4uft"} deshalb auf jeder Seite sofort. Zwei Wege. **A:** In Site Kit \u2192 Einstellungen \u2192 Admin-Einstellungen den **Consent Mode** einschalten (er ist standardm\xE4ssig aus; Voraussetzung ist das Plugin \xABWP Consent API\xBB und ein Cookie-Tool, das es unterst\xFCtzt). Der Tag wird dann zwar noch geladen, sendet aber ohne Einwilligung keine Messdaten und setzt keine Cookies; ob dir das gen\xFCgt, entscheidest du mit deiner Datenschutzberatung. **B:** Die Analytics-Anbindung in Site Kit trennen und den Tag \xFCber dein Cookie-Tool laden (n\xE4chster Schritt); dann l\xE4dt er erst nach Zustimmung.`,
|
|
12859
13327
|
codes: blocks(stack, head, "und l\xE4dt ohne Zustimmung")
|
|
12860
13328
|
};
|
|
12861
13329
|
}
|
|
@@ -12875,7 +13343,7 @@ function removeStep(stack) {
|
|
|
12875
13343
|
};
|
|
12876
13344
|
}
|
|
12877
13345
|
function requestFindings(report) {
|
|
12878
|
-
return report.violations.filter((v) => !v.advisory && v.ruleId
|
|
13346
|
+
return report.violations.filter((v) => !v.advisory && !isBannerObservation(v.ruleId));
|
|
12879
13347
|
}
|
|
12880
13348
|
var SHARED_HOST = /^(www\.)?(google\.[a-z.]+|gstatic\.com|googleapis\.com|googleusercontent\.com)$/i;
|
|
12881
13349
|
function checkTarget(url) {
|
|
@@ -12942,7 +13410,7 @@ function selfCheckStep(report) {
|
|
|
12942
13410
|
const when = noBanner ? "Beim \xD6ffnen der Seite, ohne etwas anzuklicken, darf" : "Solange der Banner offen ist und nach \xABAblehnen\xBB darf";
|
|
12943
13411
|
const before = `${when} ${clauses.join(" und ")}.`;
|
|
12944
13412
|
const appear = hosts.length > 0 && cookies.length > 0 ? "erscheinen bzw. gesetzt werden" : hosts.length === 0 && cookies.length > 0 ? "gesetzt werden" : "erscheinen";
|
|
12945
|
-
const after = noBanner ? "" : analytics ? ` Nach \xABAlles zulassen\xBB sollen sie ${appear}; so ist auch belegt, dass
|
|
13413
|
+
const after = noBanner ? "" : analytics ? ` Nach \xABAlles zulassen\xBB sollen sie ${appear}; so ist auch belegt, dass deine Statistik weiter funktioniert.` : ` Nach \xABAlles zulassen\xBB d\xFCrfen sie ${appear}.`;
|
|
12946
13414
|
return {
|
|
12947
13415
|
who: "Webagentur \xB7 kontrollieren \xB7 ca. 5 Minuten",
|
|
12948
13416
|
title: "Selbst nachpr\xFCfen",
|
|
@@ -12991,7 +13459,7 @@ function universalAnalyticsNote(stack) {
|
|
|
12991
13459
|
const ua = [...new Set([...codesOf(stack).map((c) => c.id), ...stack.googleIds].filter((x) => !!x && /^UA-/i.test(x)))];
|
|
12992
13460
|
if (ua.length === 0) return [];
|
|
12993
13461
|
return [
|
|
12994
|
-
`Hinweis: ${ua.length === 1 ? "Die Kennung" : "Die Kennungen"} ${ua.join(", ")} ${ua.length === 1 ? "geh\xF6rt" : "geh\xF6ren"} zum alten Universal Analytics. Google wertet es seit Juli 2024 nicht mehr aus. Pr\
|
|
13462
|
+
`Hinweis: ${ua.length === 1 ? "Die Kennung" : "Die Kennungen"} ${ua.join(", ")} ${ua.length === 1 ? "geh\xF6rt" : "geh\xF6ren"} zum alten Universal Analytics. Google wertet es seit Juli 2024 nicht mehr aus. Pr\xFCfe, ob dieser Tag noch gebraucht wird oder durch einen GA4-Tag (Kennung G-\u2026) ersetzt wurde; ist er \xFCberfl\xFCssig, entf\xE4llt die Umstellung und er kann entfernt werden.`
|
|
12995
13463
|
];
|
|
12996
13464
|
}
|
|
12997
13465
|
function observedIds(report) {
|
|
@@ -13014,9 +13482,9 @@ function embedRecipe(report) {
|
|
|
13014
13482
|
return {
|
|
13015
13483
|
id: "embed",
|
|
13016
13484
|
tailored: false,
|
|
13017
|
-
title: "
|
|
13485
|
+
title: "Deine L\xF6sung (Karte bzw. eingebetteter Inhalt)",
|
|
13018
13486
|
diagnosis: [
|
|
13019
|
-
`
|
|
13487
|
+
`Deine Website bindet **${what}** so ein, dass der Inhalt schon beim \xD6ffnen der Seite vom Anbieter geladen wird. Dabei erf\xE4hrt der Anbieter die Adresse des Besuchers und die besuchte Seite, bevor der Besucher entscheiden konnte. Ein Tag im Seitenkopf ist daf\xFCr nicht die Ursache; es ist der Einbau des Inhalts selbst.`
|
|
13020
13488
|
],
|
|
13021
13489
|
foundNote: foundNoteOf(stack),
|
|
13022
13490
|
steps: [
|
|
@@ -13070,9 +13538,9 @@ function bannerRecipe(report) {
|
|
|
13070
13538
|
return {
|
|
13071
13539
|
id: "banner",
|
|
13072
13540
|
tailored: false,
|
|
13073
|
-
title: "
|
|
13541
|
+
title: "Deine L\xF6sung (Gestaltung des Banners)",
|
|
13074
13542
|
diagnosis: [
|
|
13075
|
-
noChoice ? "Der Banner
|
|
13543
|
+
noChoice ? "Der Banner deiner Website zeigt einen Hinweis, bietet aber keine Wahl zwischen Zustimmen und Ablehnen. Das ist eine Frage der Einstellung bzw. des Cookie-Tools, nicht eines Tags im Seitenkopf." : "Der Banner deiner Website bietet auf der ersten Ebene kein gleichwertiges \xABAblehnen\xBB. Das ist eine Frage der Einstellung bzw. Gestaltung im Cookie-Tool, nicht eines Tags im Seitenkopf."
|
|
13076
13544
|
],
|
|
13077
13545
|
foundNote: foundNoteOf(report.stack),
|
|
13078
13546
|
steps: [bannerStructureStep(report), bannerCheckStep(report)]
|
|
@@ -13091,27 +13559,27 @@ function selectRecipeCore(report) {
|
|
|
13091
13559
|
const embedOnly = embedRecipe(report);
|
|
13092
13560
|
if (embedOnly) return embedOnly;
|
|
13093
13561
|
const stack = report.stack;
|
|
13094
|
-
const google = report.violations.some((v) => GOOGLE_NAME.test(v.trackerName) && (v.ruleId
|
|
13562
|
+
const google = report.violations.some((v) => GOOGLE_NAME.test(v.trackerName) && !isBannerObservation(v.ruleId));
|
|
13095
13563
|
const system = stack?.system;
|
|
13096
13564
|
const tool = stack?.consentTool;
|
|
13097
13565
|
const noBanner = report.bannerKind === "none";
|
|
13098
13566
|
if (stack && google && hasUngatedGoogleTag(report) && stackExplainsFindings(report, stack)) {
|
|
13099
13567
|
const label = idLabel(stack);
|
|
13100
13568
|
const many = codesOf(stack).length > 1;
|
|
13101
|
-
const
|
|
13102
|
-
const analytics = many &&
|
|
13103
|
-
const foundNote = `Gefunden im Quelltext
|
|
13569
|
+
const hasGtm2 = codesOf(stack).some((c) => c.loader === "gtm");
|
|
13570
|
+
const analytics = many && hasGtm2 ? "Google Analytics bzw. der Tag Manager" : "Google Analytics";
|
|
13571
|
+
const foundNote = `Gefunden im Quelltext deiner Startseite am ${new Date(report.scannedAt).toLocaleDateString("de-CH", { dateStyle: "long", timeZone: "Europe/Zurich" })}.`;
|
|
13104
13572
|
const embedText = stack.embeds && stack.embeds.length > 1 ? `\xFCber mehrere Plugins gleichzeitig eingebunden (${stack.embeds.map((e) => `**${e}**`).join(" und ")})` : stack.embed ? stack.embed.label === "Header Footer Code Manager" && stack.embed.snippetNo !== void 0 ? `\xFCber das Plugin **\xABHeader Footer Code Manager\xBB** eingebunden (Snippet #${stack.embed.snippetNo}${stack.embed.snippetName ? ` \xAB${stack.embed.snippetName}\xBB` : ""})` : stack.embed.label === "Theme oder Snippet-Plugin" ? "fest im Seitenkopf eingebunden (Theme oder Snippet-Plugin)" : `\xFCber **${stack.embed.label}** eingebunden` : "fest im Seitenkopf eingebunden";
|
|
13105
13573
|
const subject = many ? `Die Google-Tags (${analytics}${label ? `, ${label}` : ""}) sind` : `${analytics}${label ? ` (${label})` : ""} ist`;
|
|
13106
13574
|
if (system === "WordPress" && tool === "Pixelmate") {
|
|
13107
13575
|
const px = stack.pixelmate;
|
|
13108
|
-
const fieldNote = px ? px.statsEnabled && px.statsHeadFilled ? "Pixelmate hat daf\xFCr ein eigenes Feld f\xFCr Statistik-Skripte; bei
|
|
13576
|
+
const fieldNote = px ? px.statsEnabled && px.statsHeadFilled ? "Pixelmate hat daf\xFCr ein eigenes Feld f\xFCr Statistik-Skripte; bei dir ist es bereits bef\xFCllt, der Tag steht also zus\xE4tzlich fest im Quelltext." : "Pixelmate hat daf\xFCr ein eigenes Feld f\xFCr Statistik-Skripte; es ist bei dir leer und ausgeschaltet." : "Pixelmate hat daf\xFCr ein eigenes Feld f\xFCr Statistik-Skripte.";
|
|
13109
13577
|
return {
|
|
13110
13578
|
id: "wordpress-pixelmate",
|
|
13111
13579
|
tailored: true,
|
|
13112
|
-
title: "
|
|
13580
|
+
title: "Deine L\xF6sung, auf deine Website zugeschnitten",
|
|
13113
13581
|
diagnosis: [
|
|
13114
|
-
`
|
|
13582
|
+
`Deine Website l\xE4uft mit WordPress. ${subject} ${embedText} und deshalb auf jeder Seite sofort geladen. Dein Cookie-Tool **Pixelmate** kennt diesen Einbau nicht und kann ihn nicht zur\xFCckhalten. ${fieldNote}`,
|
|
13115
13583
|
...universalAnalyticsNote(stack)
|
|
13116
13584
|
],
|
|
13117
13585
|
foundNote,
|
|
@@ -13131,9 +13599,9 @@ function selectRecipeCore(report) {
|
|
|
13131
13599
|
return {
|
|
13132
13600
|
id: "wordpress-tool",
|
|
13133
13601
|
tailored: true,
|
|
13134
|
-
title: "
|
|
13602
|
+
title: "Deine L\xF6sung, auf deine Website zugeschnitten",
|
|
13135
13603
|
diagnosis: [
|
|
13136
|
-
`
|
|
13604
|
+
`Deine Website l\xE4uft mit WordPress und nutzt das Cookie-Tool **${tool}**. ${subject} ${embedText} und ${many ? "laufen" : "l\xE4uft"} deshalb auf jeder Seite sofort, ohne dass ${tool} es zur\xFCckhalten kann.`,
|
|
13137
13605
|
...universalAnalyticsNote(stack)
|
|
13138
13606
|
],
|
|
13139
13607
|
foundNote,
|
|
@@ -13148,9 +13616,9 @@ function selectRecipeCore(report) {
|
|
|
13148
13616
|
return {
|
|
13149
13617
|
id: "wordpress-no-tool",
|
|
13150
13618
|
tailored: true,
|
|
13151
|
-
title: "
|
|
13619
|
+
title: "Deine L\xF6sung, auf deine Website zugeschnitten",
|
|
13152
13620
|
diagnosis: [
|
|
13153
|
-
`
|
|
13621
|
+
`Deine Website l\xE4uft mit WordPress. ${subject} ${embedText} und ${many ? "laufen" : "l\xE4uft"} deshalb auf jeder Seite sofort. Im Quelltext ist kein Cookie-Tool erkennbar, das den Tag bis zur Zustimmung zur\xFCckhalten k\xF6nnte${noBanner ? "; im Test wurde auch kein Cookie-Banner gefunden" : ""}.`,
|
|
13154
13622
|
...universalAnalyticsNote(stack)
|
|
13155
13623
|
],
|
|
13156
13624
|
foundNote,
|
|
@@ -13170,9 +13638,9 @@ function selectRecipeCore(report) {
|
|
|
13170
13638
|
return {
|
|
13171
13639
|
id: "general",
|
|
13172
13640
|
tailored: false,
|
|
13173
|
-
title: "
|
|
13641
|
+
title: "Deine L\xF6sung (allgemeine Anleitung)",
|
|
13174
13642
|
diagnosis: [
|
|
13175
|
-
"F\xFCr
|
|
13643
|
+
"F\xFCr deinen Seitenaufbau liegt uns keine zugeschnittene Anleitung vor. Die folgenden Schritte gelten f\xFCr jede Website; sie sind nicht auf dein System angepasst."
|
|
13176
13644
|
],
|
|
13177
13645
|
foundNote: foundNoteOf(stack),
|
|
13178
13646
|
steps: [
|
|
@@ -13191,7 +13659,231 @@ function selectRecipeCore(report) {
|
|
|
13191
13659
|
};
|
|
13192
13660
|
}
|
|
13193
13661
|
|
|
13662
|
+
// src/core/report/codeSolutions.ts
|
|
13663
|
+
var TRACKING_RULES = /* @__PURE__ */ new Set([
|
|
13664
|
+
"pre-consent-tracking",
|
|
13665
|
+
"tracking-after-deny",
|
|
13666
|
+
"tracking-after-revoke",
|
|
13667
|
+
"tracking-without-consent",
|
|
13668
|
+
"tracking-declined-category",
|
|
13669
|
+
"tracking-after-tamper"
|
|
13670
|
+
]);
|
|
13671
|
+
var MAX_CODE_VENDORS = 8;
|
|
13672
|
+
var kindOf = (category) => category === "marketing" ? "marketing" : category === "functional" ? "functional" : "analytics";
|
|
13673
|
+
var CATEGORY_SHORT = { marketing: "Marketing", analytics: "Statistik", functional: "Komfort" };
|
|
13674
|
+
function idsFromUrls(urls) {
|
|
13675
|
+
const out = /* @__PURE__ */ new Set();
|
|
13676
|
+
const add = (label, v, min = 4) => {
|
|
13677
|
+
if (v && v.length >= min && /^[A-Za-z0-9_-]{1,40}$/.test(v)) out.add(`${label} ${v}`);
|
|
13678
|
+
};
|
|
13679
|
+
for (const raw of urls) {
|
|
13680
|
+
let u;
|
|
13681
|
+
try {
|
|
13682
|
+
u = new URL(raw);
|
|
13683
|
+
} catch {
|
|
13684
|
+
continue;
|
|
13685
|
+
}
|
|
13686
|
+
const host = u.hostname.toLowerCase();
|
|
13687
|
+
const q = u.searchParams;
|
|
13688
|
+
if (host.endsWith("pinterest.com") || host.endsWith("pinimg.com")) add("Pinterest-Tag", q.get("tid") ?? void 0);
|
|
13689
|
+
if (host.endsWith("tiktok.com")) add("TikTok-Pixel", q.get("sdkid") ?? q.get("pixel_code") ?? void 0);
|
|
13690
|
+
if (host.endsWith("linkedin.com")) add("LinkedIn-Partner-ID", q.get("pid") ?? void 0);
|
|
13691
|
+
if (host.endsWith("facebook.com") || host.endsWith("facebook.net")) add("Meta-Pixel", q.get("id") ?? void 0);
|
|
13692
|
+
if (host.endsWith("google-analytics.com") || host.endsWith("analytics.google.com") || host.endsWith("googletagmanager.com")) {
|
|
13693
|
+
add("Google-Kennung", q.get("tid") ?? q.get("id") ?? void 0);
|
|
13694
|
+
}
|
|
13695
|
+
if (host.endsWith("doubleclick.net") || host.endsWith("googleadservices.com")) add("Google-Ads-Kennung", /^AW-/.test(q.get("id") ?? "") ? q.get("id") ?? void 0 : void 0);
|
|
13696
|
+
if (q.get("idsite")) add("Matomo-Seiten-ID", q.get("idsite") ?? void 0, 1);
|
|
13697
|
+
const hj = /hotjar-(\d{4,10})\.js/.exec(u.pathname);
|
|
13698
|
+
if (hj) add("Hotjar-Seiten-ID", hj[1]);
|
|
13699
|
+
const cl = /\/tag\/([a-z0-9]{6,14})$/i.exec(u.pathname);
|
|
13700
|
+
if (host.endsWith("clarity.ms") && cl) add("Clarity-Projekt", cl[1]);
|
|
13701
|
+
}
|
|
13702
|
+
return [...out].slice(0, 3);
|
|
13703
|
+
}
|
|
13704
|
+
function scriptUrlOf(urls) {
|
|
13705
|
+
const clean = (raw) => {
|
|
13706
|
+
try {
|
|
13707
|
+
const u = new URL(raw);
|
|
13708
|
+
if (u.protocol !== "https:" && u.protocol !== "http:") return void 0;
|
|
13709
|
+
const s = `${u.origin}${u.pathname}${u.search}`;
|
|
13710
|
+
return s.length > 150 ? `${u.origin}${u.pathname}` : s;
|
|
13711
|
+
} catch {
|
|
13712
|
+
return void 0;
|
|
13713
|
+
}
|
|
13714
|
+
};
|
|
13715
|
+
const scripts = urls.filter((x) => /\.js(\?|$)/i.test(x) && !x.startsWith("cookie:"));
|
|
13716
|
+
return clean(scripts[0] ?? "") ?? void 0;
|
|
13717
|
+
}
|
|
13718
|
+
function toolMark(tool, kind, vendor) {
|
|
13719
|
+
switch (tool) {
|
|
13720
|
+
case "OneTrust":
|
|
13721
|
+
return { attr: `class="optanon-category-${kind === "marketing" ? "C0004" : kind === "functional" ? "C0003" : "C0002"}"`, label: "OneTrust" };
|
|
13722
|
+
case "Cookiebot":
|
|
13723
|
+
return { attr: `data-cookieconsent="${kind === "marketing" ? "marketing" : kind === "functional" ? "preferences" : "statistics"}"`, label: "Cookiebot" };
|
|
13724
|
+
case "Usercentrics":
|
|
13725
|
+
return { attr: `data-usercentrics="${vendor.replace(/"/g, "")}"`, label: "Usercentrics" };
|
|
13726
|
+
default:
|
|
13727
|
+
return void 0;
|
|
13728
|
+
}
|
|
13729
|
+
}
|
|
13730
|
+
var knowsTool = (tool) => toolMark(tool, "marketing", "x") !== void 0;
|
|
13731
|
+
var TOOL_NOTE = {
|
|
13732
|
+
OneTrust: "Die Kategorie-Nummern sind die Standardzuordnung von OneTrust (C0002 Statistik, C0003 Komfort, C0004 Marketing); in deiner OneTrust-Einrichtung kann die Zuordnung abweichen.",
|
|
13733
|
+
Cookiebot: 'type="text/plain" und data-cookieconsent sind die Cookiebot-Vorgabe f\xFCr das manuelle Blockieren von Skripten.',
|
|
13734
|
+
Usercentrics: "Der Name hinter data-usercentrics muss exakt dem Dienstnamen in deiner Usercentrics-Verwaltung entsprechen."
|
|
13735
|
+
};
|
|
13736
|
+
var GENERIC_ACTIVATOR = [
|
|
13737
|
+
"<script>",
|
|
13738
|
+
" // {{CMP_EREIGNIS}}: Ereignis deines Cookie-Tools nach der Wahl",
|
|
13739
|
+
" // {{KATEGORIE_ERLAUBT}}: Pr\xFCfung deines Cookie-Tools, ob die Kategorie erlaubt ist",
|
|
13740
|
+
" window.addEventListener('{{CMP_EREIGNIS}}', function () {",
|
|
13741
|
+
` var sel = 'script[type="text/plain"][data-consent]';`,
|
|
13742
|
+
" document.querySelectorAll(sel).forEach(function (s) {",
|
|
13743
|
+
" if (!{{KATEGORIE_ERLAUBT}}(s.dataset.consent)) return;",
|
|
13744
|
+
" var t = document.createElement('script');",
|
|
13745
|
+
" if (s.dataset.src) t.src = s.dataset.src; else t.text = s.text;",
|
|
13746
|
+
" s.replaceWith(t);",
|
|
13747
|
+
" });",
|
|
13748
|
+
" });",
|
|
13749
|
+
"</script>"
|
|
13750
|
+
].join("\n");
|
|
13751
|
+
function directCode(vendor, kind, src, tool) {
|
|
13752
|
+
const mark = toolMark(tool, kind, vendor);
|
|
13753
|
+
const addr = src ?? "{{SKRIPT_ADRESSE_DES_ANBIETERS}}";
|
|
13754
|
+
const before = `<!-- Vorher: l\xE4dt sofort -->
|
|
13755
|
+
<script async src="${addr}"></script>`;
|
|
13756
|
+
if (mark) {
|
|
13757
|
+
return {
|
|
13758
|
+
head: `Code f\xFCr ${mark.label}`,
|
|
13759
|
+
sub: "",
|
|
13760
|
+
text: `${before}
|
|
13761
|
+
|
|
13762
|
+
<!-- Nachher: wartet auf die Einwilligung -->
|
|
13763
|
+
<script type="text/plain" ${mark.attr}
|
|
13764
|
+
async src="${addr}"></script>`,
|
|
13765
|
+
highlight: src
|
|
13766
|
+
};
|
|
13767
|
+
}
|
|
13768
|
+
return {
|
|
13769
|
+
head: "Code",
|
|
13770
|
+
sub: "",
|
|
13771
|
+
text: `${before}
|
|
13772
|
+
|
|
13773
|
+
<!-- Nachher: wartet auf die Freigabe -->
|
|
13774
|
+
<script type="text/plain" data-consent="${kind}"
|
|
13775
|
+
data-src="${addr}"></script>`,
|
|
13776
|
+
highlight: src
|
|
13777
|
+
};
|
|
13778
|
+
}
|
|
13779
|
+
var CONSENT_MODE_BLOCK = [
|
|
13780
|
+
"<!-- Vor dem Tag-Manager-Code: alles verweigert, bis die Wahl vorliegt -->",
|
|
13781
|
+
"<script>",
|
|
13782
|
+
" window.dataLayer = window.dataLayer || [];",
|
|
13783
|
+
" function gtag(){ dataLayer.push(arguments); }",
|
|
13784
|
+
" gtag('consent', 'default', {",
|
|
13785
|
+
" ad_storage: 'denied', ad_user_data: 'denied', ad_personalization: 'denied',",
|
|
13786
|
+
" analytics_storage: 'denied', wait_for_update: 500",
|
|
13787
|
+
" });",
|
|
13788
|
+
"</script>",
|
|
13789
|
+
"",
|
|
13790
|
+
"<!-- Nach der Wahl, aus dem R\xFCckruf deines Cookie-Tools: nur Erlaubtes freigeben -->",
|
|
13791
|
+
"<script>",
|
|
13792
|
+
" gtag('consent', 'update', {",
|
|
13793
|
+
" ad_storage: 'granted', ad_user_data: 'granted', ad_personalization: 'granted', // wenn Marketing erlaubt",
|
|
13794
|
+
" analytics_storage: 'granted' // wenn Statistik erlaubt",
|
|
13795
|
+
" });",
|
|
13796
|
+
"</script>"
|
|
13797
|
+
].join("\n");
|
|
13798
|
+
var hasGtm = (report) => (report.stack?.googleTags ?? []).some((t) => t.loader === "gtm") || report.violations.some((v) => /Tag Manager/i.test(v.trackerName));
|
|
13799
|
+
function codeSolutionSteps(report, rows, options = {}) {
|
|
13800
|
+
const tool = report.stack?.consentTool;
|
|
13801
|
+
const mine = rows.filter((r) => r.blocking && TRACKING_RULES.has(r.ruleId) && !/consent-banner/i.test(r.vendor)).filter((r) => !(options.skipGoogle && /google/i.test(r.vendor)));
|
|
13802
|
+
const byVendor = /* @__PURE__ */ new Map();
|
|
13803
|
+
for (const r of mine) {
|
|
13804
|
+
const cur = byVendor.get(r.vendor);
|
|
13805
|
+
if (!cur) byVendor.set(r.vendor, { ...r, urls: [...r.urls], rules: /* @__PURE__ */ new Set([r.ruleId]) });
|
|
13806
|
+
else {
|
|
13807
|
+
cur.requests += r.requests;
|
|
13808
|
+
cur.urls.push(...r.urls);
|
|
13809
|
+
cur.rules.add(r.ruleId);
|
|
13810
|
+
}
|
|
13811
|
+
}
|
|
13812
|
+
const vendors = [...byVendor.values()].sort((a, b) => b.requests - a.requests).slice(0, MAX_CODE_VENDORS);
|
|
13813
|
+
const steps = [];
|
|
13814
|
+
if (vendors.length === 0) return steps;
|
|
13815
|
+
const gtm = hasGtm(report);
|
|
13816
|
+
const kinds = new Set(vendors.map((v) => kindOf(v.category)));
|
|
13817
|
+
const gtmKey = kinds.has("marketing") && kinds.has("analytics") ? "ad_storage (Marketing) bzw. analytics_storage (Statistik)" : kinds.has("marketing") ? "ad_storage" : "analytics_storage";
|
|
13818
|
+
const known2 = knowsTool(tool);
|
|
13819
|
+
const intro = [
|
|
13820
|
+
"**So wendest du die Code-Schritte an.** Zu jedem Anbieter mit Befund steht unten der Code, ausgef\xFCllt mit der gemessenen Skript-Adresse und, wo gemessen, der Kennung deiner Seite.",
|
|
13821
|
+
"**1. Wo steht der Tag?** Suche im Seitenquelltext bzw. im Template nach der Skript-Adresse des Anbieters. Steht sie dort, gilt der Code im jeweiligen Schritt.",
|
|
13822
|
+
gtm ? `**2. Steht sie dort nicht,** wird der Tag \xFCber den Google Tag Manager ausgeliefert: im Tag Manager beim Tag unter \xABErweiterte Einstellungen\xBB \u2192 \xABEinwilligungseinstellungen\xBB \u2192 \xABZus\xE4tzliche Einwilligung erforderlich\xBB ${gtmKey} eintragen. Daf\xFCr muss Consent Mode aktiv sein (letzter Schritt dieses Teils).` : "**2. Steht sie dort nicht,** wird der Tag \xFCber ein Tag-Management-System ausgeliefert: dort die Ausl\xF6sebedingung an die Einwilligung f\xFCr die Kategorie koppeln.",
|
|
13823
|
+
'**3. Eigener Start-Code?** Hat der Anbieter zus\xE4tzlich einen eigenen <script>-Block mit Start-Code (z. B. einen init-Aufruf), bekommt auch dieser Block type="text/plain" und dasselbe Attribut. Die Aufrufe des Anbieters bleiben unver\xE4ndert.',
|
|
13824
|
+
tool && TOOL_NOTE[tool] ? TOOL_NOTE[tool] : "",
|
|
13825
|
+
known2 ? "" : tool ? "F\xFCr dein Cookie-Tool zeigen wir das allgemeine Muster: Das Cookie-Tool gibt die zur\xFCckgehaltenen Skripte nach der Wahl frei (Freigabe-Skript unten; die Platzhalter {{\u2026}} sind aus der Dokumentation deines Cookie-Tools einzusetzen)." : "Auf deiner Seite wurde kein Cookie-Tool erkannt. Richte zuerst eines ein (siehe den ersten Schritt dieses Teils); danach gilt das allgemeine Muster: Das Cookie-Tool gibt die zur\xFCckgehaltenen Skripte nach der Wahl frei (Freigabe-Skript unten; die Platzhalter {{\u2026}} sind aus der Dokumentation deines Cookie-Tools einzusetzen)."
|
|
13826
|
+
].filter(Boolean).join("\n\n");
|
|
13827
|
+
steps.push({
|
|
13828
|
+
who: "Webagentur \xB7 Vorgehen",
|
|
13829
|
+
title: "Code-Schritte: so gehst du vor",
|
|
13830
|
+
body: intro,
|
|
13831
|
+
...known2 ? {} : { codes: [{ head: "Freigabe-Skript", sub: "\xB7 einmal f\xFCr die ganze Seite", text: GENERIC_ACTIVATOR }] }
|
|
13832
|
+
});
|
|
13833
|
+
for (const v of vendors) {
|
|
13834
|
+
const kind = kindOf(v.category);
|
|
13835
|
+
const src = scriptUrlOf(v.urls);
|
|
13836
|
+
const ids = idsFromUrls(v.urls);
|
|
13837
|
+
const hosts = [
|
|
13838
|
+
...new Set(
|
|
13839
|
+
v.urls.filter((u) => !u.startsWith("cookie:")).map((u) => {
|
|
13840
|
+
try {
|
|
13841
|
+
return new URL(u).hostname;
|
|
13842
|
+
} catch {
|
|
13843
|
+
return "";
|
|
13844
|
+
}
|
|
13845
|
+
}).filter(Boolean)
|
|
13846
|
+
)
|
|
13847
|
+
].slice(0, 3);
|
|
13848
|
+
const afterDeny = v.rules.has("tracking-after-deny") || v.rules.has("tracking-after-revoke");
|
|
13849
|
+
const body = [
|
|
13850
|
+
`**${v.vendor}** (${CATEGORY_SHORT[kind]}) ${afterDeny ? "l\xE4uft schon beim \xD6ffnen der Seite und bleibt auch nach \xABAblehnen\xBB aktiv." : "startet schon beim \xD6ffnen der Seite, bevor jemand gew\xE4hlt hat."}`,
|
|
13851
|
+
hosts.length ? `Gemessen: Anfragen an ${hosts.map((h) => `**${h}**`).join(", ")}${ids.length ? `; ${ids.map((i) => `**${i}**`).join(", ")}` : ""}.` : ""
|
|
13852
|
+
].filter(Boolean).join(" ");
|
|
13853
|
+
steps.push({
|
|
13854
|
+
who: "Webagentur \xB7 ca. 15 Minuten",
|
|
13855
|
+
title: `${v.vendor}: erst nach der Einwilligung laden`,
|
|
13856
|
+
body,
|
|
13857
|
+
codes: [directCode(v.vendor, kind, src, tool)]
|
|
13858
|
+
});
|
|
13859
|
+
}
|
|
13860
|
+
if (gtm) {
|
|
13861
|
+
steps.push({
|
|
13862
|
+
who: "Webagentur \xB7 ca. 20 Minuten",
|
|
13863
|
+
title: "Google Tag Manager: Consent Mode einrichten",
|
|
13864
|
+
body: "Der Tag Manager braucht Consent Mode, damit seine Tags die Einwilligung kennen. Der erste Block steht vor dem Tag-Manager-Code, der zweite wird vom Cookie-Tool nach der Wahl ausgel\xF6st.",
|
|
13865
|
+
codes: [{ head: "Consent Mode", sub: "\xB7 Muster f\xFCr die ganze Seite", text: CONSENT_MODE_BLOCK }]
|
|
13866
|
+
});
|
|
13867
|
+
}
|
|
13868
|
+
return steps;
|
|
13869
|
+
}
|
|
13870
|
+
|
|
13194
13871
|
// src/core/report/customerReport.ts
|
|
13872
|
+
function withCodeSolutions(base, report, inventory) {
|
|
13873
|
+
const extra = codeSolutionSteps(report, inventory, { skipGoogle: base.tailored });
|
|
13874
|
+
if (extra.length === 0) return base;
|
|
13875
|
+
const steps = [...base.steps];
|
|
13876
|
+
steps.splice(Math.max(0, steps.length - 1), 0, ...extra);
|
|
13877
|
+
if (base.tailored) return { ...base, steps };
|
|
13878
|
+
return {
|
|
13879
|
+
...base,
|
|
13880
|
+
title: "Deine L\xF6sung: Anleitung mit Code",
|
|
13881
|
+
steps,
|
|
13882
|
+
diagnosis: [
|
|
13883
|
+
"Die ersten beiden Schritte gelten f\xFCr jede Website. Zu jedem Anbieter mit Befund folgt Code, ausgef\xFCllt mit den Werten deiner Seite (gemessene Adressen und Kennungen). Wo wir ein Cookie-Tool erkannt haben, ist der Code daf\xFCr geschrieben, sonst steht ein allgemeines Muster."
|
|
13884
|
+
]
|
|
13885
|
+
};
|
|
13886
|
+
}
|
|
13195
13887
|
var esc3 = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
13196
13888
|
var rich = (s) => esc3(s).replace(/\*\*(.+?)\*\*/g, "<b>$1</b>");
|
|
13197
13889
|
var TZ = "Europe/Zurich";
|
|
@@ -13235,7 +13927,7 @@ var SCENARIO_PLAIN = {
|
|
|
13235
13927
|
"subpage-spa": {
|
|
13236
13928
|
name: "Unterseiten",
|
|
13237
13929
|
what: "Verlinkte Unterseiten ohne Wahl",
|
|
13238
|
-
fine: { title: "
|
|
13930
|
+
fine: { title: "Auch auf Unterseiten wird ohne Wahl nichts geladen", text: "Auf den gepr\xFCften Unterseiten haben wir ohne Wahl keine Tracker-Anfrage gemessen." }
|
|
13239
13931
|
},
|
|
13240
13932
|
"cmp-failure": { name: "Banner verz\xF6gert", what: "Cookie-Tool l\xE4dt langsam oder gar nicht" },
|
|
13241
13933
|
"embed-leaks": {
|
|
@@ -13247,7 +13939,7 @@ var SCENARIO_PLAIN = {
|
|
|
13247
13939
|
"duplicate-events": {
|
|
13248
13940
|
name: "Doppelte Z\xE4hlung",
|
|
13249
13941
|
what: "Seitenaufrufe nach Zustimmung",
|
|
13250
|
-
fine: { title: "Keine doppelten Z\xE4hlungen", text: "Nach der Zustimmung wird jeder Seitenaufruf genau einmal gemessen.
|
|
13942
|
+
fine: { title: "Keine doppelten Z\xE4hlungen", text: "Nach der Zustimmung wird jeder Seitenaufruf genau einmal gemessen. Deine Statistik ist in diesem Punkt sauber." }
|
|
13251
13943
|
},
|
|
13252
13944
|
"mobile-usability": {
|
|
13253
13945
|
name: "Handy",
|
|
@@ -13294,6 +13986,22 @@ var DID = {
|
|
|
13294
13986
|
"mobile-usability": "den Banner auf dem Handy bedienen",
|
|
13295
13987
|
"gpc-signal": "das Opt-out-Signal senden"
|
|
13296
13988
|
};
|
|
13989
|
+
var RULE_SHORT = {
|
|
13990
|
+
"pre-consent-tracking": "l\xE4dt vor der Auswahl",
|
|
13991
|
+
"pre-consent-embed": "Einbettung l\xE4dt vor der Zustimmung",
|
|
13992
|
+
"tracking-after-deny": "l\xE4uft nach \xABAblehnen\xBB weiter",
|
|
13993
|
+
"tracking-after-revoke": "l\xE4uft nach Widerruf weiter",
|
|
13994
|
+
"tracking-after-tamper": "l\xE4uft bei besch\xE4digter Wahl",
|
|
13995
|
+
"tracking-without-consent": "l\xE4uft ohne g\xFCltige Wahl",
|
|
13996
|
+
"tracking-declined-category": "l\xE4uft trotz abgelehnter Kategorie",
|
|
13997
|
+
"duplicate-events": "wird doppelt gez\xE4hlt",
|
|
13998
|
+
"gpc-ignored": "l\xE4uft trotz Opt-out-Signal",
|
|
13999
|
+
"no-reject-option": "Banner ohne gleichwertiges \xABAblehnen\xBB",
|
|
14000
|
+
"reject-second-level": "\xABAblehnen\xBB nur in den Einstellungen",
|
|
14001
|
+
"reject-less-prominent": "\xABAblehnen\xBB weniger auff\xE4llig als \xABAkzeptieren\xBB",
|
|
14002
|
+
"no-consent-choice": "Banner ohne Auswahl",
|
|
14003
|
+
"consent-mode-mismatch": "Consent-Mode-Zustand passt nicht zum Verhalten"
|
|
14004
|
+
};
|
|
13297
14005
|
var PROTOCOL_ORDER = [
|
|
13298
14006
|
"happy-path-denied",
|
|
13299
14007
|
"happy-path-accepted",
|
|
@@ -13364,15 +14072,15 @@ var shortUrl = (url) => {
|
|
|
13364
14072
|
};
|
|
13365
14073
|
var CONSENT_MODE_TEXT = {
|
|
13366
14074
|
title: () => "Google Consent Mode steht auf \xABerteilt\xBB, bevor jemand gew\xE4hlt hat",
|
|
13367
|
-
body: () => "Schon beim \xD6ffnen der Seite meldet
|
|
13368
|
-
headline: () => "Google Consent Mode steht auf \xABerteilt\xBB, bevor
|
|
14075
|
+
body: () => "Schon beim \xD6ffnen der Seite meldet deine Website an Google, der Besucher habe zugestimmt (Standardwert \xABerteilt\xBB), obwohl er noch nichts entschieden hat.",
|
|
14076
|
+
headline: () => "Google Consent Mode steht auf \xABerteilt\xBB, bevor deine Besucher entschieden haben"
|
|
13369
14077
|
};
|
|
13370
14078
|
var isConsentModeSignal = (tracker) => /Consent Mode/i.test(tracker);
|
|
13371
14079
|
var RULE_TEXT = {
|
|
13372
14080
|
"pre-consent-tracking": {
|
|
13373
14081
|
title: (t) => `${t} startet, bevor jemand geklickt hat`,
|
|
13374
|
-
body: (t, l) => l ? `Schon beim \xD6ffnen der Seite, w\xE4hrend der Banner noch auf eine Antwort wartet, l\xE4dt
|
|
13375
|
-
headline: (t) => `${t} startet, bevor
|
|
14082
|
+
body: (t, l) => l ? `Schon beim \xD6ffnen der Seite, w\xE4hrend der Banner noch auf eine Antwort wartet, l\xE4dt deine Website Programmcode von ${t}.` : `Schon beim \xD6ffnen der Seite, w\xE4hrend der Banner noch auf eine Antwort wartet, meldet deine Website den Besuch an ${t}.`,
|
|
14083
|
+
headline: (t) => `${t} startet, bevor deine Besucher entschieden haben`
|
|
13376
14084
|
},
|
|
13377
14085
|
"tracking-after-deny": {
|
|
13378
14086
|
title: (t) => `\xABAblehnen\xBB wird bei ${t} nicht vollst\xE4ndig umgesetzt`,
|
|
@@ -13411,7 +14119,7 @@ var RULE_TEXT = {
|
|
|
13411
14119
|
},
|
|
13412
14120
|
"duplicate-events": {
|
|
13413
14121
|
title: () => "Seitenaufrufe werden doppelt gez\xE4hlt",
|
|
13414
|
-
body: (t) => `Nach der Zustimmung meldet die Seite denselben Seitenaufruf mehrfach an ${t}.
|
|
14122
|
+
body: (t) => `Nach der Zustimmung meldet die Seite denselben Seitenaufruf mehrfach an ${t}. Deine Statistik z\xE4hlt zu hoch.`,
|
|
13415
14123
|
headline: () => "Seitenaufrufe werden doppelt gez\xE4hlt"
|
|
13416
14124
|
},
|
|
13417
14125
|
"consent-mode-mismatch": {
|
|
@@ -13424,6 +14132,16 @@ var RULE_TEXT = {
|
|
|
13424
14132
|
body: () => "Im Banner gibt es keine M\xF6glichkeit, gleich einfach abzulehnen wie zuzustimmen.",
|
|
13425
14133
|
headline: () => "im Banner l\xE4sst sich nicht gleichwertig ablehnen"
|
|
13426
14134
|
},
|
|
14135
|
+
"reject-second-level": {
|
|
14136
|
+
title: () => "\xABAblehnen\xBB gibt es nur in den Einstellungen, nicht auf der ersten Ebene",
|
|
14137
|
+
body: () => "Zustimmen geht im Banner mit einem Klick, abgelehnt werden kann erst \xFCber die Einstellungen (mehrere Klicks).",
|
|
14138
|
+
headline: () => "Ablehnen ist nur \xFCber die Einstellungen m\xF6glich"
|
|
14139
|
+
},
|
|
14140
|
+
"reject-less-prominent": {
|
|
14141
|
+
title: () => "\xABAblehnen\xBB ist weniger auff\xE4llig als \xABAkzeptieren\xBB",
|
|
14142
|
+
body: () => "Im Banner ist \xABAblehnen\xBB kleiner oder schw\xE4cher gestaltet als \xABAkzeptieren\xBB (die gemessenen Werte stehen im technischen Nachweis).",
|
|
14143
|
+
headline: () => "\xABAblehnen\xBB ist weniger auff\xE4llig gestaltet"
|
|
14144
|
+
},
|
|
13427
14145
|
"no-consent-choice": {
|
|
13428
14146
|
title: () => "Der Banner bietet keine Wahl",
|
|
13429
14147
|
body: () => "Der Banner l\xE4sst dem Besucher keine Auswahl zwischen Zustimmen und Ablehnen.",
|
|
@@ -13436,7 +14154,7 @@ var RULE_TEXT = {
|
|
|
13436
14154
|
}
|
|
13437
14155
|
};
|
|
13438
14156
|
var COOKIE_BODY = {
|
|
13439
|
-
"pre-consent-tracking": (t) => `Schon beim \xD6ffnen der Seite, w\xE4hrend der Banner noch auf eine Antwort wartet, setzt
|
|
14157
|
+
"pre-consent-tracking": (t) => `Schon beim \xD6ffnen der Seite, w\xE4hrend der Banner noch auf eine Antwort wartet, setzt deine Website Cookies von ${t}.`,
|
|
13440
14158
|
"tracking-after-deny": (t) => `Ein Besucher klickt \xABAblehnen\xBB und surft weiter. Trotzdem setzt die Seite weiter Cookies von ${t}.`,
|
|
13441
14159
|
"tracking-without-consent": (t) => `Ist die gespeicherte Wahl nicht mehr vorhanden (Speicher gel\xF6scht), verh\xE4lt sich die Seite wie vor jeder Entscheidung und setzt Cookies von ${t}.`,
|
|
13442
14160
|
"tracking-after-tamper": (t) => `Wird die gespeicherte Ablehnung unlesbar (zum Beispiel durch einen Fehler oder ein Browser-Update) und die Seite neu geladen, setzt sie Cookies von ${t}.`
|
|
@@ -13453,7 +14171,7 @@ var ADVISORY_TEXT = {
|
|
|
13453
14171
|
var TODO_TEXT = {
|
|
13454
14172
|
"pre-consent-tracking": (t) => ({
|
|
13455
14173
|
title: `${t} erst nach der Wahl des Besuchers starten`,
|
|
13456
|
-
body: `Der Tag darf nicht mehr fest im Seitenkopf stehen, sondern muss vom Cookie-Tool erst nach Zustimmung zur passenden Kategorie ausgeliefert werden. Die Anleitung f\xFCr
|
|
14174
|
+
body: `Der Tag darf nicht mehr fest im Seitenkopf stehen, sondern muss vom Cookie-Tool erst nach Zustimmung zur passenden Kategorie ausgeliefert werden. Die Anleitung f\xFCr deine Website steht in Teil 2.`
|
|
13457
14175
|
}),
|
|
13458
14176
|
"tracking-after-deny": (t) => ({
|
|
13459
14177
|
title: "Gespeicherte Ablehnung bei jedem Seitenaufruf beachten",
|
|
@@ -13495,6 +14213,14 @@ var TODO_TEXT = {
|
|
|
13495
14213
|
title: "\xABAblehnen\xBB gleichwertig anbieten",
|
|
13496
14214
|
body: "Im Banner auf der ersten Ebene einen Ablehnen-Knopf anbieten, gleich auff\xE4llig wie \xABAlles zulassen\xBB."
|
|
13497
14215
|
}),
|
|
14216
|
+
"reject-second-level": () => ({
|
|
14217
|
+
title: "\xABAblehnen\xBB auf die erste Ebene des Banners setzen",
|
|
14218
|
+
body: "Im Banner direkt neben \xABAlles zulassen\xBB ein \xABAblehnen\xBB (oder \xABNur notwendige\xBB) anbieten, gleich gross und gleich auff\xE4llig. Die Einstellungen bleiben f\xFCr die Auswahl nach Kategorien."
|
|
14219
|
+
}),
|
|
14220
|
+
"reject-less-prominent": () => ({
|
|
14221
|
+
title: "\xABAblehnen\xBB gleich auff\xE4llig gestalten",
|
|
14222
|
+
body: "\xABAblehnen\xBB in derselben Gr\xF6sse, Schriftgr\xF6sse und Farbst\xE4rke darstellen wie \xABAlles zulassen\xBB, nicht als blosser Textlink."
|
|
14223
|
+
}),
|
|
13498
14224
|
"no-consent-choice": () => ({
|
|
13499
14225
|
title: "Dem Banner eine Wahl geben",
|
|
13500
14226
|
body: "Der Banner muss Zustimmen und Ablehnen anbieten."
|
|
@@ -13509,21 +14235,21 @@ function todoOf(p) {
|
|
|
13509
14235
|
return {
|
|
13510
14236
|
who: "Webagentur \xB7 beheben",
|
|
13511
14237
|
title: `${p.tracker} erst nach Zustimmung einblenden und einen Cookie-Banner einrichten`,
|
|
13512
|
-
body: "Den eingebetteten Inhalt durch einen Platzhalter ersetzen (\xABInhalt anzeigen\xBB) und erst nach Zustimmung laden; daf\xFCr ein Cookie-Tool einrichten. Die Anleitung f\xFCr
|
|
14238
|
+
body: "Den eingebetteten Inhalt durch einen Platzhalter ersetzen (\xABInhalt anzeigen\xBB) und erst nach Zustimmung laden; daf\xFCr ein Cookie-Tool einrichten. Die Anleitung f\xFCr deine Website steht in Teil 2."
|
|
13513
14239
|
};
|
|
13514
14240
|
}
|
|
13515
14241
|
if (p.cookieOnly && p.ruleId === "pre-consent-tracking") {
|
|
13516
14242
|
return {
|
|
13517
14243
|
who: "Webagentur \xB7 beheben",
|
|
13518
14244
|
title: p.noBanner ? `Cookie-Banner einrichten und ${p.tracker} erst nach Zustimmung starten` : `Cookies von ${p.tracker} erst nach der Wahl des Besuchers setzen`,
|
|
13519
|
-
body: "Das Skript, das diese Cookies setzt, darf erst laufen, wenn der Besucher der passenden Kategorie zugestimmt hat; es \xFCber das Cookie-Tool nach der Wahl ausliefern. Die Anleitung f\xFCr
|
|
14245
|
+
body: "Das Skript, das diese Cookies setzt, darf erst laufen, wenn der Besucher der passenden Kategorie zugestimmt hat; es \xFCber das Cookie-Tool nach der Wahl ausliefern. Die Anleitung f\xFCr deine Website steht in Teil 2."
|
|
13520
14246
|
};
|
|
13521
14247
|
}
|
|
13522
14248
|
if (p.noBanner) {
|
|
13523
14249
|
return {
|
|
13524
14250
|
who: "Webagentur \xB7 beheben",
|
|
13525
14251
|
title: `Cookie-Banner einrichten und ${p.tracker} erst nach Zustimmung starten`,
|
|
13526
|
-
body: "Ein Cookie-Tool installieren, das Skripte bis zur Wahl des Besuchers zur\xFCckh\xE4lt, und den Tag dar\xFCber ausliefern. Die Anleitung f\xFCr
|
|
14252
|
+
body: "Ein Cookie-Tool installieren, das Skripte bis zur Wahl des Besuchers zur\xFCckh\xE4lt, und den Tag dar\xFCber ausliefern. Die Anleitung f\xFCr deine Website steht in Teil 2."
|
|
13527
14253
|
};
|
|
13528
14254
|
}
|
|
13529
14255
|
if (p.ruleId === "pre-consent-embed") {
|
|
@@ -13572,6 +14298,7 @@ function buildPoints(report, gate, checkedTotal) {
|
|
|
13572
14298
|
const hints = hintViolations(report.violations, strict, profiles);
|
|
13573
14299
|
const unproven = bannerUnproven(report, gate);
|
|
13574
14300
|
const all = [];
|
|
14301
|
+
const inventory = [];
|
|
13575
14302
|
const subpageLeakPaths = [
|
|
13576
14303
|
...new Set(
|
|
13577
14304
|
(report.evidence ?? []).filter((e) => e.scenario === "subpage-spa").flatMap((e) => [...(e.actionTimeline ?? []).map((a) => a.action), ...e.actionSequence]).map((a) => /^leak:subpage\s+(\S+)/.exec(a)?.[1]).filter((x) => !!x).map((x) => {
|
|
@@ -13598,9 +14325,10 @@ function buildPoints(report, gate, checkedTotal) {
|
|
|
13598
14325
|
const observedCookies = [...new Set(list.filter((v) => v.requestUrl.startsWith("cookie:")).map((v) => v.requestUrl.slice("cookie:".length).split("@")[0]))];
|
|
13599
14326
|
const cookieOnly = requestList.length === 0 && observedCookies.length > 0;
|
|
13600
14327
|
const requests = requestList.length === 1 ? "1 Anfrage" : `${requestList.length} Anfragen`;
|
|
13601
|
-
|
|
14328
|
+
inventory.push({ vendor: tracker, what: RULE_SHORT[ruleId] ?? "weitere Beobachtung", requests: requestList.length, cookies: observedCookies, flows: scenarios.length, blocking: isBlocking, ruleId, category: String(list[0]?.trackerCategory ?? "unknown"), urls: [...new Set(requestList.map((v) => v.requestUrl))].slice(0, 12) });
|
|
14329
|
+
const noTracker = isBannerObservation(ruleId);
|
|
13602
14330
|
const subpageOnly = scenarios.length > 0 && scenarios.every((sc) => sc === "subpage-spa");
|
|
13603
|
-
const where = subpageOnly ? subpageLeakPaths.length > 0 ? ` Beobachtet nur auf ${subpageLeakPaths.length === 1 ? "der Unterseite" : "den Unterseiten"} ${listJoin(subpageLeakPaths.slice(0, 3))}, nicht auf der Startseite.` : " Beobachtet nur beim Besuch von Unterseiten, nicht auf der Startseite." : scenarios.length > 0 ? ` Gleiches Bild in ${scenarios.length} von ${checkedTotal} ${checkedTotal === 1 ? "
|
|
14331
|
+
const where = subpageOnly ? subpageLeakPaths.length > 0 ? ` Beobachtet nur auf ${subpageLeakPaths.length === 1 ? "der Unterseite" : "den Unterseiten"} ${listJoin(subpageLeakPaths.slice(0, 3))}, nicht auf der Startseite.` : " Beobachtet nur beim Besuch von Unterseiten, nicht auf der Startseite." : scenarios.length > 0 ? ` Gleiches Bild in ${scenarios.length} von ${checkedTotal} ${checkedTotal === 1 ? "ausgef\xFChrtem Ablauf" : "ausgef\xFChrten Abl\xE4ufen"}.` : "";
|
|
13604
14332
|
const id = idsText(list.map((v) => v.requestUrl), tracker);
|
|
13605
14333
|
const cookies = [
|
|
13606
14334
|
.../* @__PURE__ */ new Set([
|
|
@@ -13616,7 +14344,7 @@ function buildPoints(report, gate, checkedTotal) {
|
|
|
13616
14344
|
num: 0,
|
|
13617
14345
|
tag: isBlocking ? "must" : "should",
|
|
13618
14346
|
title: functionalHint ? ADVISORY_TEXT.title(tracker) : nb ? `${tracker} ${embedNb ? "l\xE4dt" : "l\xE4uft"}, obwohl kein Cookie-Banner vorhanden ist` : unk ? `${tracker} ${ruleId === "pre-consent-embed" ? "l\xE4dt" : "startet"} beim \xD6ffnen der Seite` : t.title(tracker),
|
|
13619
|
-
body: functionalHint ? ADVISORY_TEXT.body(tracker) : unk ? ruleId === "pre-consent-embed" ? `Der eingebettete Inhalt von ${tracker} baut schon beim \xD6ffnen der Seite eine Verbindung zum Anbieter auf. Ob die Seite einen Cookie-Banner hat, ist nicht belegt (siehe Hinweise zur Pr\xFCfung).` : `Beim \xD6ffnen der Seite ${cookieOnly ? `setzt
|
|
14347
|
+
body: functionalHint ? ADVISORY_TEXT.body(tracker) : unk ? ruleId === "pre-consent-embed" ? `Der eingebettete Inhalt von ${tracker} baut schon beim \xD6ffnen der Seite eine Verbindung zum Anbieter auf. Ob die Seite einen Cookie-Banner hat, ist nicht belegt (siehe Hinweise zur Pr\xFCfung).` : `Beim \xD6ffnen der Seite ${cookieOnly ? `setzt deine Website Cookies von ${tracker}` : loaderOnly ? `l\xE4dt deine Website Programmcode von ${tracker}` : `meldet deine Website den Besuch an ${tracker}`}. Ob die Seite einen Cookie-Banner hat, ist nicht belegt (siehe Hinweise zur Pr\xFCfung).` : embedNb ? `Der eingebettete Inhalt von ${tracker} baut schon beim \xD6ffnen der Seite eine Verbindung zum Anbieter auf. Im Test wurde kein Cookie-Banner gefunden: Besucher k\xF6nnen gar nicht entscheiden.` : nb && cookieOnly ? `Beim \xD6ffnen der Seite setzt deine Website Cookies von ${tracker}. Im Test wurde kein Cookie-Banner gefunden: Besucher k\xF6nnen gar nicht entscheiden.` : cookieOnly && COOKIE_BODY[ruleId] ? COOKIE_BODY[ruleId](tracker) : nb ? `Beim \xD6ffnen der Seite ${loaderOnly ? `l\xE4dt deine Website Programmcode von ${tracker}` : `meldet deine Website den Besuch an ${tracker}`}. Im Test wurde kein Cookie-Banner gefunden: Besucher k\xF6nnen gar nicht entscheiden.` : t.body(tracker, loaderOnly),
|
|
13620
14348
|
measured,
|
|
13621
14349
|
ruleId,
|
|
13622
14350
|
tracker,
|
|
@@ -13641,7 +14369,8 @@ function buildPoints(report, gate, checkedTotal) {
|
|
|
13641
14369
|
const blockingCount = all.filter((p) => p.blocking).length;
|
|
13642
14370
|
const moreBlocking = blockingCount - shown.filter((p) => p.blocking).length;
|
|
13643
14371
|
const moreHints = all.filter((p) => !p.blocking).length - shown.filter((p) => !p.blocking).length;
|
|
13644
|
-
|
|
14372
|
+
inventory.sort((a, b) => Number(b.blocking) - Number(a.blocking) || b.requests - a.requests || a.vendor.localeCompare(b.vendor, "de"));
|
|
14373
|
+
return { shown, moreBlocking, moreHints, blockingCount, inventory };
|
|
13645
14374
|
}
|
|
13646
14375
|
var PROOF_PREFERENCE = {
|
|
13647
14376
|
"pre-consent-tracking": ["happy-path-denied", "banner-ignored"],
|
|
@@ -13697,11 +14426,14 @@ function proofFor(report, point) {
|
|
|
13697
14426
|
...rows.length < items.length ? { note: `Gek\xFCrzt: ${items.length - rows.length} weitere Zeilen in den Rohdaten.` } : {}
|
|
13698
14427
|
};
|
|
13699
14428
|
}
|
|
13700
|
-
function
|
|
13701
|
-
|
|
14429
|
+
function measuredIn(report, scenario) {
|
|
14430
|
+
return (report.violations ?? []).filter((v) => v.scenario === scenario).length;
|
|
14431
|
+
}
|
|
14432
|
+
function resultOf(ev, refs, measured = 0) {
|
|
14433
|
+
if (refs.length > 0) return { result: actionMissing(ev) ? `Nicht ausf\xFChrbar; Befund beim \xD6ffnen der Seite (Punkt ${refs.join(", ")})` : `Befund (Punkt ${refs.join(", ")})`, tone: "bad" };
|
|
13702
14434
|
switch (ev.status) {
|
|
13703
14435
|
case "passed":
|
|
13704
|
-
return { result: "in Ordnung", tone: "ok" };
|
|
14436
|
+
return measured > 0 || (ev.hintFindings ?? 0) > 0 ? { result: "Hinweis (nicht blockierend)", tone: "hint" } : { result: "in Ordnung", tone: "ok" };
|
|
13705
14437
|
case "not-applicable":
|
|
13706
14438
|
return { result: "nicht anwendbar", tone: "na" };
|
|
13707
14439
|
case "not-checkable":
|
|
@@ -13725,7 +14457,7 @@ function protocolFor(report, points) {
|
|
|
13725
14457
|
if (!ev) continue;
|
|
13726
14458
|
const plain = SCENARIO_PLAIN[scenario];
|
|
13727
14459
|
const refs = points.filter((p) => p.scenarios.includes(scenario)).map((p) => p.num);
|
|
13728
|
-
const { result, tone } = resultOf(ev, refs);
|
|
14460
|
+
const { result, tone } = resultOf(ev, refs, measuredIn(report, scenario));
|
|
13729
14461
|
rows.push({ name: plain.name, what: plain.what, result, tone });
|
|
13730
14462
|
}
|
|
13731
14463
|
return rows;
|
|
@@ -13772,7 +14504,7 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13772
14504
|
})();
|
|
13773
14505
|
const withFindings = new Set(report.violations.map((v) => v.scenario));
|
|
13774
14506
|
const ran = new Set(evidence.filter((e) => !isUncheckable(e) || withFindings.has(e.scenario)).map((e) => e.scenario)).size;
|
|
13775
|
-
const { shown, moreBlocking, moreHints, blockingCount } = buildPoints(report, gate, Math.max(ran, 1));
|
|
14507
|
+
const { shown, moreBlocking, moreHints, blockingCount, inventory } = buildPoints(report, gate, Math.max(ran, 1));
|
|
13776
14508
|
const mustCount = shown.filter((p) => p.blocking).length;
|
|
13777
14509
|
const failed = facts.gateState === "blocked" || facts.gateState === "fix-proposed";
|
|
13778
14510
|
const inconclusive = facts.gateState === "inconclusive";
|
|
@@ -13785,7 +14517,7 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13785
14517
|
const nothingToCheck = facts.gateState === "clean" && gate?.nothingToCheck === true;
|
|
13786
14518
|
const noBannerPoints = blockingShown.filter((p) => p.noBanner);
|
|
13787
14519
|
const preGroup = blockingShown.filter((p) => p.ruleId === "pre-consent-tracking" && !p.noBanner && !p.unprovenBanner && !isConsentModeSignal(p.tracker));
|
|
13788
|
-
const head = nothingToCheck ? "Kein Cookie-Banner und keine Tracker gefunden: es gab nichts zu pr\xFCfen." : failed && noBannerPoints.length >= 2 ? `Auf
|
|
14520
|
+
const head = nothingToCheck ? "Kein Cookie-Banner und keine Tracker gefunden: es gab nichts zu pr\xFCfen." : failed && noBannerPoints.length >= 2 ? `Auf deiner Seite wurde kein Cookie-Banner gefunden, trotzdem laufen ${listJoin([...new Set(noBannerPoints.map((p) => p.tracker))].slice(0, 3))}.` : failed ? sameVendorPair ? `${blockingShown[0].tracker} startet, bevor deine Besucher entschieden haben, und ${blockingShown.find((p) => p.ruleId === "tracking-after-deny")?.loaderOnly ? "wird auch nach \xABAblehnen\xBB weiter geladen" : "l\xE4uft auch nach \xABAblehnen\xBB weiter"}.` : preGroup.length >= 2 ? `${listJoin([...new Set(preGroup.map((p) => p.tracker))].slice(0, 3))} starten, bevor deine Besucher entschieden haben.` : headParts.map((h) => `${cap(h)}.`).join(" ") : inconclusive ? report.bannerKind === "none" ? "Auf deiner Seite wurde kein Cookie-Banner gefunden; die Abl\xE4ufe zum Ablehnen und Zustimmen liessen sich deshalb nicht pr\xFCfen." : "Der Test konnte nicht vollst\xE4ndig durchgef\xFChrt werden." : "In den gepr\xFCften Abl\xE4ufen wurde kein Verstoss gegen die Regeln des Gates gemessen.";
|
|
13789
14521
|
const gateNotes = gateNotesOf(gate, report);
|
|
13790
14522
|
const notes = [
|
|
13791
14523
|
// Fix-Stand wörtlich: «verifiziert auf der Vorschau-URL» ist nicht «die Seite ist sauber».
|
|
@@ -13798,12 +14530,13 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13798
14530
|
...gate?.sampling?.incomplete ? [`Stichprobe: ${gate.sampling.checked} von ${gate.sampling.linked} verlinkten Unterseiten gepr\xFCft; nicht gepr\xFCfte Seiten k\xF6nnen weitere Befunde enthalten.`] : [],
|
|
13799
14531
|
...facts.advisory > 0 && !failed ? [`Bei ${facts.advisory === 1 ? "1 Anfrage" : `${facts.advisory} Anfragen`} wurden Hinweise ohne Gate-Wirkung gemessen (siehe technischer Nachweis).`] : []
|
|
13800
14532
|
];
|
|
13801
|
-
const lead = failed ? `${blockingCount === 1 ? "Ein Punkt ist zu beheben" : `${blockingCount} Punkte sind zu beheben`}${shown.some((p) => !p.blocking) ? ", dazu kommen Empfehlungen" : ""}. Was zu tun ist, steht weiter unten; die Anleitung f\xFCr
|
|
14533
|
+
const lead = failed ? `${blockingCount === 1 ? "Ein Punkt ist zu beheben" : `${blockingCount} Punkte sind zu beheben`}${shown.some((p) => !p.blocking) ? ", dazu kommen Empfehlungen" : ""}. Was zu tun ist, steht weiter unten; die Anleitung f\xFCr deine Webagentur beginnt in Teil 2.` : inconclusive ? "Ein Teil der Abl\xE4ufe liess sich nicht pr\xFCfen. \xABNicht pr\xFCfbar\xBB heisst nicht bestanden. Die Gr\xFCnde stehen unten und im Pr\xFCfprotokoll." : "Das ist eine Momentaufnahme f\xFCr den angegebenen Zeitpunkt. Ein nicht gefundenes Merkmal ergibt kein Zertifikat.";
|
|
13802
14534
|
const profiles = resolveJurisdictions(gate?.jurisdiction);
|
|
13803
14535
|
const frameworks = [...new Set(profiles.flatMap((p) => p.frameworks.filter((f) => !/Consent Mode|Opt-out model/i.test(f)).slice(0, 3)))].join(", ");
|
|
13804
14536
|
const nums = blockingShown.map((p) => String(p.num));
|
|
13805
|
-
const einordnung = `Bewertet nach ${jurisdictionModelLabel(profiles)}. ` + (failed && nums.length ? `${nums.length === 1 ? "Punkt" : "Punkte"} ${listJoin(nums)} ${nums.length === 1 ? "l\xF6st" : "l\xF6sen"} nach diesem Regelwerk das technische Gate aus. ` : "") +
|
|
13806
|
-
|
|
14537
|
+
const einordnung = `Bewertet nach ${jurisdictionModelLabel(profiles)}. ` + (failed && nums.length ? `${nums.length === 1 ? "Punkt" : "Punkte"} ${listJoin(nums)} ${nums.length === 1 ? "l\xF6st" : "l\xF6sen"} nach diesem Regelwerk das technische Gate aus. ` : "") + // Schweiz: ein Schweizer Leser kennt «Widerspruch» als «darf vorher laufen». Der Bericht sagt deshalb, woher die strengere Lesart kommt (Rechtsprüfung PG-01).
|
|
14538
|
+
(profiles.some((p) => p.consentModel === "objection") && inventory.some((i) => i.blocking && i.ruleId === "pre-consent-tracking") ? "Zur Schweiz: Nach dem Gesetzeswortlaut (FMG Art. 45c) gen\xFCgen Information und eine funktionierende Ablehnung. Der ED\xD6B verlangt dar\xFCber hinaus, dass nicht notwendige Tracker erst nach der M\xF6glichkeit zum Widerspruch starten (Leitfaden Cookies, Ziff. 3.9); CPCG folgt dieser Aufsichtsposition. Was nach \xABAblehnen\xBB weiterl\xE4uft, ist in jedem Fall ein Befund. " : "") + "Regelwerk von CPCG, technische Messung, keine Rechtsberatung.";
|
|
14539
|
+
const recipe = withCodeSolutions(selectRecipe(report), report, inventory);
|
|
13807
14540
|
const todo = shown.map(todoOf);
|
|
13808
14541
|
const fine = [];
|
|
13809
14542
|
const denied = evidence.find((e) => e.scenario === "happy-path-denied");
|
|
@@ -13813,7 +14546,7 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13813
14546
|
for (const scenario of PROTOCOL_ORDER) {
|
|
13814
14547
|
const ev = evidence.find((e) => e.scenario === scenario);
|
|
13815
14548
|
const f = SCENARIO_PLAIN[scenario].fine;
|
|
13816
|
-
if (ev && f && ev.status === "passed" && !isUncheckable(ev)) fine.push(f);
|
|
14549
|
+
if (ev && f && ev.status === "passed" && !isUncheckable(ev) && measuredIn(report, scenario) === 0 && (ev.hintFindings ?? 0) === 0) fine.push(f);
|
|
13817
14550
|
}
|
|
13818
14551
|
const fineShown = fine.slice(0, 6);
|
|
13819
14552
|
const sampled = report.subpageSampling;
|
|
@@ -13828,9 +14561,15 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13828
14561
|
}).map((sc) => DID[sc]);
|
|
13829
14562
|
const who = report.visitor?.profile === "eu" ? "der EU" : "der Schweiz";
|
|
13830
14563
|
const noBannerRun = report.bannerKind === "none";
|
|
13831
|
-
const howChecked = noBannerRun ? `Ein echter Chrome-Browser hat
|
|
14564
|
+
const howChecked = noBannerRun ? `Ein echter Chrome-Browser hat deine Seite wie ein Besucher aus ${who} ge\xF6ffnet und jede Anfrage an Dritte mitgeschrieben. Ein Cookie-Banner wurde nicht gefunden; die Abl\xE4ufe zum Ablehnen und Zustimmen liessen sich deshalb nicht ausf\xFChren. Gepr\xFCft wurde, was die Seite ohne jede Wahl des Besuchers l\xE4dt.` : facts.checked === 0 ? `Ein echter Chrome-Browser hat deine Seite wie ein Besucher aus ${who} ge\xF6ffnet. In diesem Lauf konnte kein Ablauf abschliessend gepr\xFCft werden; die Gr\xFCnde stehen unten und im Pr\xFCfprotokoll. Dabei wurde jede Anfrage an Dritte mitgeschrieben.` : `Ein echter Chrome-Browser hat deine Seite wie ein Besucher aus ${who} ge\xF6ffnet und den Banner in ${facts.checked} Abl\xE4ufen bedient: ${listJoin(did)}. Dabei wurde jede Anfrage an Dritte mitgeschrieben.`;
|
|
14565
|
+
const protocolTotal = PROTOCOL_ORDER.filter((sc) => evidence.some((e) => e.scenario === sc)).length;
|
|
13832
14566
|
const scopeBoxes = [
|
|
13833
|
-
|
|
14567
|
+
// Eine Zählung, drei Begriffe: vorgesehen (Zeilen im Prüfprotokoll), ausgeführt (der Ablauf lief, auch wenn nicht abschliessend prüfbar) und
|
|
14568
|
+
// abschliessend bewertet («Prüfabläufe»). Die Zahlen in den Befunden («x von y ausgeführten Abläufen») beziehen sich auf «ausgeführt».
|
|
14569
|
+
{
|
|
14570
|
+
label: "Umfang",
|
|
14571
|
+
text: `${scope} \xB7 ${protocolTotal === 1 ? "1 Ablauf" : `${protocolTotal} Abl\xE4ufe`} vorgesehen, ${ran} ausgef\xFChrt, ${facts.checked === 1 ? "1 Pr\xFCfablauf" : `${facts.checked} Pr\xFCfabl\xE4ufe`} abschliessend bewertet`
|
|
14572
|
+
},
|
|
13834
14573
|
{ label: "Besucher", text: `${profile}, Chrome` },
|
|
13835
14574
|
...notChecked.length ? [
|
|
13836
14575
|
{
|
|
@@ -13838,6 +14577,8 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13838
14577
|
text: notChecked.map((e) => `${SCENARIO_PLAIN[e.scenario].name}${e.reason ? ` \u2013 ${customerReason(e.reason)}` : ""}`).join("; ")
|
|
13839
14578
|
}
|
|
13840
14579
|
] : [],
|
|
14580
|
+
// Abgrenzung: gemessen wird das Verhalten der Seite und des Banners, nicht ein Rechtstext.
|
|
14581
|
+
{ label: "Nicht Gegenstand", text: "Datenschutzerkl\xE4rung, Impressum und andere Rechtstexte; ob Zwecke und Dienste verst\xE4ndlich genannt sind; eine rechtliche W\xFCrdigung" },
|
|
13841
14582
|
{ label: "Nachvollziehbar", text: "Messdaten mit Zeitstempeln und Pr\xFCfsummen im technischen Nachweis" }
|
|
13842
14583
|
];
|
|
13843
14584
|
const proofs = shown.map((p) => proofFor(report, p)).filter((x) => x !== void 0);
|
|
@@ -13868,6 +14609,7 @@ function buildCustomerReport(report, options = {}) {
|
|
|
13868
14609
|
lead,
|
|
13869
14610
|
notes,
|
|
13870
14611
|
points: shown,
|
|
14612
|
+
inventory,
|
|
13871
14613
|
moreFindings: moreBlocking,
|
|
13872
14614
|
moreHints,
|
|
13873
14615
|
einordnung,
|
|
@@ -13973,15 +14715,25 @@ function renderCustomerReportHtml(m) {
|
|
|
13973
14715
|
...m.moreFindings > 0 ? [m.moreFindings === 1 ? `ein ${more ? "weiterer" : ""} Punkt zu beheben` : `${m.moreFindings} ${more} Punkte zu beheben`] : [],
|
|
13974
14716
|
...moreHints > 0 && (anyShown || !hintsInNotes) ? [moreHints === 1 ? `ein ${more === "weitere" ? "weiterer " : ""}Hinweis ohne Gate-Wirkung` : `${moreHints} ${more} Hinweise ohne Gate-Wirkung`] : []
|
|
13975
14717
|
].map((p) => p.replace(/\s{2,}/g, " "));
|
|
13976
|
-
const
|
|
14718
|
+
const hasFix = m.points.length > 0 || m.moreFindings > 0 || (m.inventory ?? []).some((i) => i.blocking);
|
|
14719
|
+
const evidencePart = hasFix ? 3 : 2;
|
|
14720
|
+
const moreLine = moreParts.length > 0 ? `<p class="small" style="margin-top:3mm">${anyShown ? "Nicht oben gezeigt" : "Ausserdem gemessen"}: ${moreParts.join(" und ")}. Alle Befunde stehen vollst\xE4ndig in Teil ${evidencePart} unter \xABAlle Befunde\xBB; die Rohdaten liegen als Datei bei.</p>` : "";
|
|
14721
|
+
const INV_MAX = 80;
|
|
14722
|
+
const inv = m.inventory ?? [];
|
|
14723
|
+
const inventoryHtml = inv.length === 0 ? "" : `<h2 style="margin-top:9mm">Alle Befunde</h2>
|
|
14724
|
+
<p class="seen">Jede gemessene Gruppe, nicht nur die oben gezeigten. \xABZu beheben\xBB l\xF6st nach dem Regelwerk das Gate aus; \xABHinweis\xBB wurde gemessen, blockiert aber nicht. Im Bericht sind gleichartige Anbieter zu einem \xABPunkt\xBB zusammengefasst; die Konsole und der Vergleich z\xE4hlen \xABProblemgruppen\xBB (jede Regel und jeder Anbietername einzeln), deshalb weichen die Zahlen leicht ab. Messwerte k\xF6nnen von Messung zu Messung schwanken (Werbetechnik l\xE4dt nicht bei jedem Besuch gleich): massgeblich f\xFCr die Nachpr\xFCfung ist, welche Anbieter betroffen sind, nicht die genaue Zahl der Anfragen.</p>
|
|
14725
|
+
<table class="t"><tr><th>Anbieter</th><th>Befund</th><th style="width:20mm">Anfragen</th><th>Cookies</th><th style="width:16mm">Abl\xE4ufe</th><th style="width:24mm">Wirkung</th></tr>
|
|
14726
|
+
${inv.slice(0, INV_MAX).map(
|
|
14727
|
+
(r) => `<tr><td><b>${esc3(r.vendor)}</b></td><td>${esc3(r.what)}</td><td>${r.requests}</td><td class="mono">${esc3(r.cookies.slice(0, 4).join(", ") + (r.cookies.length > 4 ? ` \u2026 (+${r.cookies.length - 4})` : ""))}</td><td>${r.flows}</td><td><span class="pill ${r.blocking ? "bad" : "hint"}">${r.blocking ? "Zu beheben" : "Hinweis"}</span></td></tr>`
|
|
14728
|
+
).join("")}</table>${inv.length > INV_MAX ? `<p class="small">Weitere ${inv.length - INV_MAX} Gruppen stehen in den Rohdaten (Beilage).</p>` : ""}`;
|
|
13977
14729
|
const todo = m.todo.length > 0 ? `<section class="block"><h2>Was zu tun ist</h2>
|
|
13978
|
-
<p class="lead">${m.todo.length === 1 ? "Ein Schritt." : `${m.todo.length} Schritte.`}
|
|
14730
|
+
<p class="lead">${m.todo.length === 1 ? "Ein Schritt." : `${m.todo.length} Schritte.`} Du kannst diese Seite direkt an deine Webagentur weitergeben; die zugeschnittene Anleitung folgt in Teil 2.</p>
|
|
13979
14731
|
<ol class="steps">${m.todo.map((t) => `<li><div class="who">${esc3(t.who)}</div><h3>${esc3(t.title)}</h3><p>${esc3(t.body)}</p></li>`).join("")}</ol>
|
|
13980
|
-
<div class="handover"><h3>Danach: Nachpr\xFCfung</h3><p>Sobald die \xC4nderungen online sind, pr\xFCfen wir die Seite mit demselben Testablauf erneut. Der neue Bericht zeigt pro Punkt, ob er erledigt ist. So
|
|
14732
|
+
<div class="handover"><h3>Danach: Nachpr\xFCfung</h3><p>Sobald die \xC4nderungen online sind, pr\xFCfen wir die Seite mit demselben Testablauf erneut. Der neue Bericht zeigt pro Punkt, ob er erledigt ist. So hast du es schriftlich, mit Datum.</p></div></section>` : "";
|
|
13981
14733
|
const fine = m.fine.length > 0 ? `<section class="block"><h2>Was bereits stimmt</h2>${m.fine.map((f) => `<div class="ok"><div class="check">\u2713</div><div><h3>${esc3(f.title)}</h3><p class="seen">${esc3(f.text)}</p></div></div>`).join("")}</section>` : "";
|
|
13982
14734
|
const recipe = m.recipe;
|
|
13983
14735
|
const steps = recipe.steps.map(
|
|
13984
|
-
(s) => `<li><div class="who">${esc3(s.who)}</div><h3>${esc3(s.title)}</h3
|
|
14736
|
+
(s) => `<li><div class="who">${esc3(s.who)}</div><h3>${esc3(s.title)}</h3>${s.body.split("\n\n").map((para) => `<p>${rich(para)}</p>`).join("")}${(s.codes ?? []).map((c) => `<div class="codehead"><span>${rich(c.head)}${c.sub ? ` ${esc3(c.sub)}` : ""}</span></div><pre class="code">${codeHtml(c.text, c.highlight)}</pre>`).join("")}</li>`
|
|
13985
14737
|
).join("");
|
|
13986
14738
|
const proofs = m.proofs.map(
|
|
13987
14739
|
(p) => `<h3 style="margin-top:5mm">${esc3(p.title)}</h3>
|
|
@@ -13994,7 +14746,7 @@ function renderCustomerReportHtml(m) {
|
|
|
13994
14746
|
|
|
13995
14747
|
${customerHeader(`Erstellt f\xFCr ${esc3(m.client)}<br>Messung vom ${esc3(m.dateLong)}`)}
|
|
13996
14748
|
${m.demo ? `<div class="demo">Demo-Bericht \xB7 synthetische Testdaten, keine realen Kundendaten</div>` : ""}
|
|
13997
|
-
<h1>
|
|
14749
|
+
<h1>Dein Cookie-Banner<br>im Praxistest</h1>
|
|
13998
14750
|
<div class="site">${esc3(m.host)} \xB7 ${esc3(m.scope)}</div>
|
|
13999
14751
|
<div class="verdict ${m.tone}"><div class="lamp"><span class="r"></span><span class="a"></span><span class="g"></span></div>
|
|
14000
14752
|
<div><div class="label">${esc3(m.label)}</div><div class="head">${esc3(m.head)}</div><p>${esc3(m.lead)}</p></div></div>
|
|
@@ -14007,24 +14759,25 @@ ${fine}
|
|
|
14007
14759
|
<div class="scope">${m.scopeBoxes.map((b) => `<div><b>${esc3(b.label)}</b>${esc3(b.text)}</div>`).join("")}</div>
|
|
14008
14760
|
<p class="small" style="margin-top:6mm">Dieser Bericht beschreibt, was technisch gemessen wurde, zum angegebenen Zeitpunkt. Er ist keine Rechtsberatung und kein Zertifikat; \xABnicht beobachtet\xBB heisst nicht \xABnicht vorhanden\xBB.${m.version ? ` CuonzTech \xB7 Privacy Chaos Gate ${esc3(m.version)}.` : ""}</p></section>
|
|
14009
14761
|
|
|
14010
|
-
|
|
14011
|
-
${customerHeader(`Teil 2 \xB7
|
|
14012
|
-
<div class="part">Teil 2 \xB7 F\xFCr
|
|
14762
|
+
${hasFix ? `<div class="pagebreak"></div>
|
|
14763
|
+
${customerHeader(`Teil 2 \xB7 Deine L\xF6sung<br>${esc3(m.host)}`)}
|
|
14764
|
+
<div class="part">Teil 2 \xB7 F\xFCr deine Webagentur</div>
|
|
14013
14765
|
<h2>${esc3(recipe.title)}</h2>
|
|
14014
|
-
${recipe.tailored ? "" : `<div class="rule" style="margin-top:0;margin-bottom:4mm"><b>Hinweis:</b> Diese Anleitung ist allgemein gehalten und nicht auf
|
|
14766
|
+
${recipe.tailored ? "" : `<div class="rule" style="margin-top:0;margin-bottom:4mm"><b>Hinweis:</b> ${recipe.steps.some((st) => (st.codes ?? []).length > 0) ? "Das Ger\xFCst ist allgemein gehalten; der Code zu deinen Anbietern tr\xE4gt die Werte deiner Seite. Die Schreibweise der Kategorien bitte in deinem Cookie-Tool gegenpr\xFCfen und den Code vor dem Einsatz testen." : "Diese Anleitung ist allgemein gehalten und nicht auf dein System zugeschnitten."}</div>`}
|
|
14015
14767
|
<div class="diag"><h3>${recipe.tailored ? "Woher das Problem kommt" : "Vorgehen"}</h3>${recipe.diagnosis.map((d) => `<p>${rich(d)}</p>`).join("")}<p class="small">${esc3(recipe.foundNote)}</p></div>
|
|
14016
14768
|
<ol class="steps">${steps}</ol>
|
|
14017
|
-
<div class="handover"><h3>Nachpr\xFCfung durch CuonzTech</h3><p>
|
|
14018
|
-
${recipe.tailored ? `<div class="rule"><b>Was sich f\xFCr
|
|
14769
|
+
<div class="handover"><h3>Nachpr\xFCfung durch CuonzTech</h3><p>Melde die Umsetzung an support@cuonztech.ch. Wir pr\xFCfen mit denselben Abl\xE4ufen erneut und best\xE4tigen dir pro Punkt schriftlich, ob er erledigt ist.</p></div>
|
|
14770
|
+
${recipe.tailored ? `<div class="rule"><b>Was sich f\xFCr dich \xE4ndert:</b> Deine Besucherstatistik z\xE4hlt danach nur noch Besucher, die Statistik erlaubt haben. Die Zahlen in deinem Statistik-Dienst werden kleiner, daf\xFCr belastbar.</div>` : ""}` : ""}
|
|
14019
14771
|
|
|
14020
14772
|
<div class="pagebreak"></div>
|
|
14021
|
-
${customerHeader(`Teil
|
|
14022
|
-
<div class="part">Teil
|
|
14773
|
+
${customerHeader(`Teil ${evidencePart} \xB7 Technischer Nachweis<br>${esc3(m.host)}`)}
|
|
14774
|
+
<div class="part">Teil ${evidencePart} \xB7 Technischer Nachweis</div>
|
|
14023
14775
|
<h2>Was genau gemessen wurde</h2>
|
|
14024
14776
|
<p class="seen">Uhrzeiten in Schweizer Zeit. Jede Zeile ist eine Anfrage des Browsers an einen Dritten.</p>
|
|
14025
|
-
${proofs || `<p class="seen">Zu den gezeigten Punkten liegen keine Einzelanfragen vor.</p>`}
|
|
14777
|
+
${proofs || (inv.length === 0 ? `<p class="seen">Vor jeder Auswahl wurden keine Anfragen an Dritte gemessen; es gibt nichts zu belegen.</p>` : `<p class="seen">Zu den gezeigten Punkten liegen keine Einzelanfragen vor.</p>`)}
|
|
14778
|
+
${inventoryHtml}
|
|
14026
14779
|
<h2 style="margin-top:9mm">Pr\xFCfprotokoll</h2>
|
|
14027
|
-
<p class="seen">Alle Abl\xE4ufe dieser Pr\xFCfung mit Ergebnis. \xABNicht automatisch pr\xFCfbar\xBB heisst nicht bestanden, sondern nicht gemessen.</p>
|
|
14780
|
+
<p class="seen">Alle ${m.protocol.length} Abl\xE4ufe dieser Pr\xFCfung mit Ergebnis. \xABNicht automatisch pr\xFCfbar\xBB heisst nicht bestanden, sondern nicht gemessen.</p>
|
|
14028
14781
|
<table class="t"><tr><th style="width:40mm">Ablauf</th><th>Was getestet wurde</th><th style="width:48mm">Ergebnis</th></tr>
|
|
14029
14782
|
${m.protocol.map((r) => `<tr><td><b>${esc3(r.name)}</b></td><td>${esc3(r.what)}</td><td><span class="pill ${r.tone}">${esc3(r.result)}</span></td></tr>`).join("")}</table>
|
|
14030
14783
|
<h3 style="margin-top:7mm">Messumgebung und Beweissicherung</h3>
|
|
@@ -14171,8 +14924,15 @@ function compareVisits(ch, eu) {
|
|
|
14171
14924
|
onlyCh = [...cs].filter((k) => !es.has(k)).sort();
|
|
14172
14925
|
onlyEu = [...es].filter((k) => !cs.has(k)).sort();
|
|
14173
14926
|
both = [...cs].filter((k) => es.has(k)).sort();
|
|
14174
|
-
|
|
14175
|
-
|
|
14927
|
+
const hintIn = (v, k) => v.detail.advisory.some((a) => a.trackerName === k);
|
|
14928
|
+
const euAbsent = onlyEu.filter((k) => !hintIn(ch, k));
|
|
14929
|
+
const euHintInCh = onlyEu.filter((k) => hintIn(ch, k));
|
|
14930
|
+
const chAbsent = onlyCh.filter((k) => !hintIn(eu, k));
|
|
14931
|
+
const chHintInEu = onlyCh.filter((k) => hintIn(eu, k));
|
|
14932
|
+
if (euAbsent.length > 0) lines.push(`Nur im ${VISIT_LABEL.eu} gefunden: ${names(euAbsent)}.`);
|
|
14933
|
+
if (euHintInCh.length > 0) lines.push(`Im ${VISIT_LABEL.eu} ein Befund, im ${VISIT_LABEL.ch} nur als Hinweis ohne Gate-Wirkung gemessen: ${names(euHintInCh)}.`);
|
|
14934
|
+
if (chAbsent.length > 0) lines.push(`Nur im ${VISIT_LABEL.ch} gefunden: ${names(chAbsent)}.`);
|
|
14935
|
+
if (chHintInEu.length > 0) lines.push(`Im ${VISIT_LABEL.ch} ein Befund, im ${VISIT_LABEL.eu} nur als Hinweis ohne Gate-Wirkung gemessen: ${names(chHintInEu)}.`);
|
|
14176
14936
|
if (both.length > 0) lines.push(`In beiden Besuchen (Schweiz und EU) gefunden: ${names(both)}.`);
|
|
14177
14937
|
const cc = ch.detail.cookiesBeforeChoice;
|
|
14178
14938
|
const ec = eu.detail.cookiesBeforeChoice;
|
|
@@ -14206,7 +14966,7 @@ function compareVisits(ch, eu) {
|
|
|
14206
14966
|
|
|
14207
14967
|
// src/core/report/limitedPdf.ts
|
|
14208
14968
|
var plural3 = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
14209
|
-
var
|
|
14969
|
+
var hostOf2 = (url) => {
|
|
14210
14970
|
try {
|
|
14211
14971
|
return new URL(url).hostname;
|
|
14212
14972
|
} catch {
|
|
@@ -14218,7 +14978,7 @@ function verdictOf(f) {
|
|
|
14218
14978
|
const tone = blocked ? "red" : f.state === "inconclusive" || f.state === "clean" && f.uncheckable > 0 && !f.nothingToCheck ? "amber" : "green";
|
|
14219
14979
|
const label = blocked ? "Ergebnis: Handlungsbedarf" : tone === "amber" ? "Ergebnis: nicht abschliessend pr\xFCfbar" : "Ergebnis: keine Auff\xE4lligkeit gemessen";
|
|
14220
14980
|
const head = blocked ? `${plural3(f.groups, "Problemgruppe", "Problemgruppen")} gemessen, ${plural3(f.requests, "Anfrage", "Anfragen")} in ${plural3(f.scenarios, "Ablauf", "Abl\xE4ufen")}.` : f.nothingToCheck ? "Kein Cookie-Banner und keine Tracker gefunden: es gab nichts zu pr\xFCfen." : tone === "amber" ? `${f.uncheckable} von ${f.scenariosTotal} Pr\xFCfabl\xE4ufen liessen sich nicht pr\xFCfen.` : "In den gepr\xFCften Abl\xE4ufen wurde kein Verstoss gegen die Regeln des Gates gemessen.";
|
|
14221
|
-
const lead = blocked ? "
|
|
14981
|
+
const lead = blocked ? "Deine Seite hat in diesem Test gegen die Regeln des Gates verstossen. Wer was wann gesendet hat und wie sich das beheben l\xE4sst, steht im vollst\xE4ndigen Bericht." : "Das ist eine Momentaufnahme f\xFCr den angegebenen Zeitpunkt. Ein nicht gefundenes Merkmal ergibt kein Zertifikat.";
|
|
14222
14982
|
const tiles = [
|
|
14223
14983
|
[String(f.groups), "Problemgruppen"],
|
|
14224
14984
|
[String(f.requests), "Anfragen an Dritte"],
|
|
@@ -14246,38 +15006,139 @@ var PDF_CSS = `
|
|
|
14246
15006
|
.miss { border: 1px dashed var(--line); border-radius: 2mm; padding: 4mm; margin: 0 0 6mm; color: var(--muted); }`;
|
|
14247
15007
|
var WHAT_IS_IN_THE_REPORT = `<h2>Was im vollst\xE4ndigen Bericht steht</h2>
|
|
14248
15008
|
<ul class="plain">
|
|
14249
|
-
<li>Welche Anbieter betroffen sind und wann sie laden, mit Zeitabfolge und Bildschirmfoto
|
|
14250
|
-
<li>Eine Anleitung f\xFCr
|
|
15009
|
+
<li>Welche Anbieter betroffen sind und wann sie laden, mit Zeitabfolge und Bildschirmfoto deines Banners.</li>
|
|
15010
|
+
<li>Eine Anleitung f\xFCr deine Webagentur, auf deine Website zugeschnitten, mit dem Code deiner Seite.</li>
|
|
14251
15011
|
<li>Das Pr\xFCfprotokoll aller Abl\xE4ufe und die Rohdaten, gegen Ver\xE4nderung gesichert.</li>
|
|
14252
15012
|
<li>Eine Nachpr\xFCfung nach der Umsetzung, schriftlich und mit Datum.</li>
|
|
14253
15013
|
</ul>`;
|
|
14254
|
-
var
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
15014
|
+
var INTRO_PRICE_UNTIL = Date.UTC(2027, 0, 1);
|
|
15015
|
+
var priceNote = (now = Date.now()) => now < INTRO_PRICE_UNTIL ? "(netto, einmalig; Einf\xFChrungspreis CHF 390 bis 31.12.2026)" : "(netto, einmalig)";
|
|
15016
|
+
var buyBox = () => `<div class="buy"><h3>Vollst\xE4ndigen Bericht erhalten</h3>
|
|
15017
|
+
<p><b>Pr\xFCfpaket: CHF 890</b> ${priceNote()}. Kundenbericht, Auto-Fix-Vorschlag als Pull Request, 1 Domain, 90 Tage.</p>
|
|
15018
|
+
<p>Bestellen: <b>cuonztech.ch/privacy-chaos-gate</b> oder <b>support@cuonztech.ch</b>. Mit dem Lizenzschl\xFCssel denselben Lauf wiederholen: der vollst\xE4ndige Bericht entsteht automatisch.</p>
|
|
15019
|
+
<p>Ohne Installation: Mit dem Kunden-Key deines Pr\xFCfpakets l\xE4sst sich die Pr\xFCfung auch im Browser starten, unter <b>cuonztech.ch/pruefen</b>.</p></div>`;
|
|
15020
|
+
var footnote = (version) => `<p class="small" style="margin-top:6mm">Dieses Kurzergebnis nennt nur Zahlen. Es beschreibt, was technisch gemessen wurde, zum angegebenen Zeitpunkt; die Zahlen k\xF6nnen von Messung zu Messung schwanken, weil Werbetechnik nicht bei jedem Besuch gleich l\xE4dt. Es ist keine Rechtsberatung und kein Zertifikat; \xABnicht beobachtet\xBB heisst nicht \xABnicht vorhanden\xBB. CuonzTech \xB7 Privacy Chaos Gate ${esc3(version)}.</p>`;
|
|
14258
15021
|
var dateOf = (iso) => new Date(iso).toLocaleDateString("de-CH", { dateStyle: "long", timeZone: "Europe/Zurich" });
|
|
15022
|
+
var timeOf2 = (iso) => new Date(iso).toLocaleTimeString("de-CH", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Zurich" });
|
|
15023
|
+
var messkennung = (targetUrl, scannedAt) => createHash2("sha256").update(`${targetUrl}|${scannedAt}`).digest("hex").slice(0, 8).toUpperCase();
|
|
15024
|
+
var NEUTRAL_CSS = `
|
|
15025
|
+
.neutral { border: 1px solid var(--line); background: var(--tint); border-radius: 3mm; padding: 5mm 6mm; margin-bottom: 5mm; break-inside: avoid; }
|
|
15026
|
+
.neutral .label { font-size: 8.5pt; letter-spacing: .14em; text-transform: uppercase; font-weight: 650; color: var(--muted); }
|
|
15027
|
+
.neutral .head { font-size: 15pt; font-weight: 650; color: var(--ink); margin: 1mm 0 2mm; line-height: 1.25; }
|
|
15028
|
+
.neutral p { color: var(--soft); margin: 0; }
|
|
15029
|
+
.tile b.txt { font-size: 13pt; line-height: 1.5; }`;
|
|
15030
|
+
var WHAT_IS_IN_THE_REPORT_NEUTRAL = `<h2>Was im vollst\xE4ndigen Bericht steht</h2>
|
|
15031
|
+
<ul class="plain">
|
|
15032
|
+
<li>Welche Anbieter betroffen sind und wann sie laden, mit Zeitabfolge und Bildschirmfoto des Banners.</li>
|
|
15033
|
+
<li>Eine Anleitung f\xFCr die Webagentur, auf die Website zugeschnitten, mit dem Code der Seite.</li>
|
|
15034
|
+
<li>Das Pr\xFCfprotokoll aller Abl\xE4ufe und die Rohdaten, gegen Ver\xE4nderung gesichert.</li>
|
|
15035
|
+
<li>Eine Nachpr\xFCfung nach der Umsetzung, schriftlich und mit Datum.</li>
|
|
15036
|
+
</ul>`;
|
|
15037
|
+
var REJECT_TEXT = { yes: "ja", no: "nein", unknown: "nicht pr\xFCfbar" };
|
|
15038
|
+
function neutralOf(f, when) {
|
|
15039
|
+
const pre = f.preSelection;
|
|
15040
|
+
const uncheckableLine = `Bei ${f.uncheckable} von ${f.scenariosTotal} Abl\xE4ufen konnte die Seite nicht gepr\xFCft werden (zum Beispiel wegen Bot-Schutz).`;
|
|
15041
|
+
let head;
|
|
15042
|
+
let lead = `Diese Zahlen beschreiben, was der Pr\xFCfroboter von CuonzTech am ${when.date} um ${when.time} bei einem Pr\xFCflauf aus der Schweiz beobachtet hat. Sie sind keine Aussage dar\xFCber, ob die Seite Gesetze einh\xE4lt.`;
|
|
15043
|
+
if (f.nothingToCheck) {
|
|
15044
|
+
head = "Es wurde kein Cookie-Banner gefunden und keine Anfrage an Drittanbieter beobachtet.";
|
|
15045
|
+
} else if (f.requests > 0) {
|
|
15046
|
+
head = !pre ? `In diesem Pr\xFCflauf wurden ${plural3(f.requests, "Anfrage", "Anfragen")} an Drittanbieter beobachtet (in ${f.scenarios} von ${f.scenariosTotal} Abl\xE4ufen).` : pre.requests > 0 ? `In diesem Pr\xFCflauf wurden ${plural3(pre.requests, "Anfrage", "Anfragen")} an Drittanbieter beobachtet, bevor im Cookie-Banner etwas ausgew\xE4hlt wurde (in ${pre.scenarios} von ${f.scenariosTotal} Abl\xE4ufen).` : `In diesem Pr\xFCflauf wurden ${plural3(f.requests, "Anfrage", "Anfragen")} an Drittanbieter beobachtet, keine davon, bevor im Cookie-Banner etwas ausgew\xE4hlt wurde.`;
|
|
15047
|
+
} else if (f.state === "inconclusive" || f.uncheckable > 0) {
|
|
15048
|
+
head = uncheckableLine;
|
|
15049
|
+
} else {
|
|
15050
|
+
head = "In diesem Pr\xFCflauf wurden keine Anfragen an Drittanbieter beobachtet, bevor im Cookie-Banner etwas ausgew\xE4hlt wurde.";
|
|
15051
|
+
lead = "Das sagt nichts \xFCber andere Zeitpunkte, andere Besucher (zum Beispiel aus der EU) oder andere Seiten und ist kein Zeugnis.";
|
|
15052
|
+
}
|
|
15053
|
+
const extra = f.uncheckable > 0 && head !== uncheckableLine && !f.nothingToCheck ? `<p class="small">${esc3(uncheckableLine)}</p>` : "";
|
|
15054
|
+
const tiles = [
|
|
15055
|
+
[String(f.groups), "Gruppen von Drittanbietern"],
|
|
15056
|
+
[String(f.requests), "Anfragen an Dritte"],
|
|
15057
|
+
[`${pre?.scenarios ?? f.scenarios} von ${f.scenariosTotal}`, "Abl\xE4ufe mit Anfragen vor der Auswahl"],
|
|
15058
|
+
[String(f.uncheckable), "nicht pr\xFCfbar"],
|
|
15059
|
+
[REJECT_TEXT[f.rejectWorks ?? "unknown"], "Ablehnen wirkt", true]
|
|
15060
|
+
];
|
|
15061
|
+
return { head, lead, extra, tiles };
|
|
15062
|
+
}
|
|
15063
|
+
var neutralBlock = (f, when) => {
|
|
15064
|
+
const n = neutralOf(f, when);
|
|
15065
|
+
return `<div class="neutral"><div class="label">Messwerte aus einem Pr\xFCflauf</div><div class="head">${esc3(n.head)}</div><p>${esc3(n.lead)}</p></div>${n.extra}
|
|
15066
|
+
<div class="tiles">${n.tiles.map(([x, l, txt]) => `<div class="tile"><b${txt ? ' class="txt"' : ""}>${esc3(x)}</b><span>${esc3(l)}</span></div>`).join("")}</div>`;
|
|
15067
|
+
};
|
|
15068
|
+
var neutralFootnote = (scenariosTotal, base, when, visits) => `<p class="small" style="margin-top:6mm">Technische Beobachtung eines Pr\xFCflaufs von CuonzTech${visits ? "" : " aus der Schweiz"} am ${esc3(when.date)} um ${esc3(when.time)}, Pr\xFCfroboter Privacy Chaos Gate ${esc3(base.version)}. Gepr\xFCft wurden die Startseite in ${scenariosTotal} Abl\xE4ufen und bis zu ${base.maxSubpages ?? 3} verlinkte Unterseiten; es ist eine Stichprobe, keine vollst\xE4ndige Pr\xFCfung der Website. Die Zahlen k\xF6nnen bei jedem Lauf abweichen, weil Werbetechnik nicht bei jedem Besuch gleich l\xE4dt. \xABNicht beobachtet\xBB heisst nicht \xABnicht vorhanden\xBB. Keine Aussage zu Besuchen aus anderen L\xE4ndern, zu einzelnen Diensten oder zur Rechtm\xE4ssigkeit. Keine Rechtsberatung, kein Zertifikat, keine Freigabe. Weitergabe nur vollst\xE4ndig und mit diesem Hinweis. Messkennung: ${messkennung(base.targetUrl, base.scannedAt)}.</p>`;
|
|
15069
|
+
function neutralDocument(host, when, body) {
|
|
15070
|
+
return `<!DOCTYPE html>
|
|
15071
|
+
<html lang="de-CH"><head><meta charset="utf-8"><title>Cookie-Banner-Schnelltest ${esc3(host)}</title>
|
|
15072
|
+
<style>${PDF_FONT_FACE_CSS}</style><style>${CUSTOMER_CSS}${PDF_CSS}${NEUTRAL_CSS}
|
|
15073
|
+
</style></head><body>
|
|
15074
|
+
${customerHeader(`Messung f\xFCr ${esc3(host)}, ${esc3(when.date)} ${esc3(when.time)} (Schweizer Zeit)`)}
|
|
15075
|
+
<h1>Cookie-Banner-Schnelltest:<br>Messwerte f\xFCr ${esc3(host)}</h1>
|
|
15076
|
+
${body}
|
|
15077
|
+
</body></html>`;
|
|
15078
|
+
}
|
|
14259
15079
|
function buildLimitedPdfHtml(f, base) {
|
|
14260
|
-
const host =
|
|
15080
|
+
const host = hostOf2(base.targetUrl);
|
|
14261
15081
|
const licenseNote = f.reason === "none" ? "" : `<p class="small">${esc3(limitedReason(f))}</p>`;
|
|
15082
|
+
if (base.schnelltest) {
|
|
15083
|
+
const when = { date: dateOf(base.scannedAt), time: timeOf2(base.scannedAt) };
|
|
15084
|
+
return neutralDocument(
|
|
15085
|
+
host,
|
|
15086
|
+
when,
|
|
15087
|
+
`${neutralBlock(f, when)}
|
|
15088
|
+
|
|
15089
|
+
${WHAT_IS_IN_THE_REPORT_NEUTRAL}
|
|
15090
|
+
|
|
15091
|
+
${buyBox()}
|
|
15092
|
+
|
|
15093
|
+
${licenseNote}
|
|
15094
|
+
${neutralFootnote(f.scenariosTotal, base, when, false)}`
|
|
15095
|
+
);
|
|
15096
|
+
}
|
|
14262
15097
|
return `<!DOCTYPE html>
|
|
14263
15098
|
<html lang="de-CH"><head><meta charset="utf-8"><title>Consent-Kurzergebnis ${esc3(host)}</title>
|
|
14264
15099
|
<style>${PDF_FONT_FACE_CSS}</style><style>${CUSTOMER_CSS}${PDF_CSS}
|
|
14265
15100
|
</style></head><body>
|
|
14266
15101
|
${customerHeader(`Erstellt f\xFCr ${esc3(host)}<br>Messung vom ${esc3(dateOf(base.scannedAt))}`)}
|
|
14267
|
-
<h1>
|
|
15102
|
+
<h1>Dein Cookie-Banner<br>im Praxistest: Kurzergebnis</h1>
|
|
14268
15103
|
<div class="site">${esc3(host)}</div>
|
|
14269
15104
|
${verdictBlock(verdictOf(f))}
|
|
14270
15105
|
|
|
14271
15106
|
${WHAT_IS_IN_THE_REPORT}
|
|
14272
15107
|
|
|
14273
|
-
${
|
|
15108
|
+
${buyBox()}
|
|
14274
15109
|
|
|
14275
15110
|
${licenseNote}
|
|
14276
15111
|
${footnote(base.version)}
|
|
14277
15112
|
</body></html>`;
|
|
14278
15113
|
}
|
|
14279
15114
|
function buildLimitedVisitsPdfHtml(ch, eu, base, exits = {}, missing = []) {
|
|
14280
|
-
const host =
|
|
15115
|
+
const host = hostOf2(base.targetUrl);
|
|
15116
|
+
if (base.schnelltest) {
|
|
15117
|
+
const when = { date: dateOf(base.scannedAt), time: timeOf2(base.scannedAt) };
|
|
15118
|
+
const neutralVisit = (visit, f) => {
|
|
15119
|
+
if (!f) {
|
|
15120
|
+
const m = missing.find((x) => x.visit === visit);
|
|
15121
|
+
return `<h2>${esc3(VISIT_LABEL[visit])}</h2><div class="miss"><b>Nicht gepr\xFCft.</b> ${esc3(m?.detail ?? "Dieser Besuch lief nicht")}. \xDCber ihn macht dieses Ergebnis keine Aussage.</div>`;
|
|
15122
|
+
}
|
|
15123
|
+
const country = visit === "eu" && exits.eu?.country ? ` (IP-Land ${esc3(exits.eu.country)})` : "";
|
|
15124
|
+
return `<h2>${esc3(VISIT_LABEL[visit])}${country}</h2>${neutralBlock(f, when)}`;
|
|
15125
|
+
};
|
|
15126
|
+
const first2 = ch ?? eu;
|
|
15127
|
+
const note = !first2 || first2.reason === "none" ? "" : `<p class="small">${esc3(limitedReason(first2))}</p>`;
|
|
15128
|
+
return neutralDocument(
|
|
15129
|
+
host,
|
|
15130
|
+
when,
|
|
15131
|
+
`${neutralVisit("ch", ch)}
|
|
15132
|
+
${neutralVisit("eu", eu)}
|
|
15133
|
+
|
|
15134
|
+
${WHAT_IS_IN_THE_REPORT_NEUTRAL}
|
|
15135
|
+
|
|
15136
|
+
${buyBox()}
|
|
15137
|
+
|
|
15138
|
+
${note}
|
|
15139
|
+
${neutralFootnote(first2?.scenariosTotal ?? 0, base, when, true)}`
|
|
15140
|
+
);
|
|
15141
|
+
}
|
|
14281
15142
|
const cmp = compareVisits(
|
|
14282
15143
|
ch ? viewOfFacts("ch", ch, exits.ch ? { profile: "ch", ...exits.ch } : void 0) : void 0,
|
|
14283
15144
|
eu ? viewOfFacts("eu", eu, exits.eu ? { profile: "eu", ...exits.eu } : void 0) : void 0
|
|
@@ -14299,7 +15160,7 @@ function buildLimitedVisitsPdfHtml(ch, eu, base, exits = {}, missing = []) {
|
|
|
14299
15160
|
<style>${PDF_FONT_FACE_CSS}</style><style>${CUSTOMER_CSS}${PDF_CSS}
|
|
14300
15161
|
</style></head><body>
|
|
14301
15162
|
${customerHeader(`Erstellt f\xFCr ${esc3(host)}<br>Messung vom ${esc3(dateOf(base.scannedAt))}`)}
|
|
14302
|
-
<h1>
|
|
15163
|
+
<h1>Dein Cookie-Banner<br>im Praxistest: Kurzergebnis</h1>
|
|
14303
15164
|
<div class="site">${esc3(host)}</div>
|
|
14304
15165
|
<div class="small" style="margin:0 0 4mm">Zwei Besuche: aus der Schweiz (direkt) und aus der EU (\xFCber einen Ausgang in der EU). Jeder Rechtsraum wird nach seinem Besuch bewertet.</div>
|
|
14305
15166
|
${block("ch", ch)}
|
|
@@ -14310,7 +15171,7 @@ ${block("eu", eu)}
|
|
|
14310
15171
|
|
|
14311
15172
|
${WHAT_IS_IN_THE_REPORT}
|
|
14312
15173
|
|
|
14313
|
-
${
|
|
15174
|
+
${buyBox()}
|
|
14314
15175
|
|
|
14315
15176
|
${licenseNote}
|
|
14316
15177
|
${footnote(base.version)}
|
|
@@ -14318,7 +15179,7 @@ ${footnote(base.version)}
|
|
|
14318
15179
|
}
|
|
14319
15180
|
|
|
14320
15181
|
// src/core/report/visitComparePdf.ts
|
|
14321
|
-
var
|
|
15182
|
+
var hostOf3 = (url) => {
|
|
14322
15183
|
try {
|
|
14323
15184
|
return new URL(url).hostname;
|
|
14324
15185
|
} catch {
|
|
@@ -14333,7 +15194,7 @@ var CSS2 = `
|
|
|
14333
15194
|
ul.plain { margin: 0 0 5mm; padding-left: 5mm; } ul.plain li { margin-bottom: 1.8mm; }
|
|
14334
15195
|
.exit { border: 1px solid var(--line); border-radius: 2mm; padding: 3mm 4mm; margin: 0 0 4mm; font-size: 9pt; color: var(--muted); }`;
|
|
14335
15196
|
function buildComparisonHtml(ch, eu, base) {
|
|
14336
|
-
const host =
|
|
15197
|
+
const host = hostOf3(base.targetUrl);
|
|
14337
15198
|
const date = new Date(base.scannedAt).toLocaleDateString("de-CH", { dateStyle: "long", timeZone: "Europe/Zurich" });
|
|
14338
15199
|
const cmp = compareVisits(ch, eu);
|
|
14339
15200
|
const rows = cmp.rows.map((r) => `<tr${r.differs ? ' class="diff"' : ""}><td>${esc3(r.label)}</td><td>${esc3(r.ch)}</td><td>${esc3(r.eu)}</td></tr>`).join("");
|
|
@@ -14357,171 +15218,10 @@ ${customerHeader(`Erstellt f\xFCr ${esc3(base.client)}<br>Messung vom ${esc3(dat
|
|
|
14357
15218
|
<ul class="plain">${cmp.lines.map((l) => `<li>${esc3(l)}</li>`).join("")}</ul>
|
|
14358
15219
|
${exits.length ? `<div class="exit"><b>Messumgebung:</b> ${exits.join(" \xB7 ")}</div>` : ""}
|
|
14359
15220
|
${files.length ? `<p class="small">Die Einzelheiten stehen im Kundenbericht des jeweiligen Besuchs: ${files.join("; ")}.</p>` : ""}
|
|
14360
|
-
<p class="small" style="margin-top:6mm">Technische Beobachtung zum angegebenen Zeitpunkt,
|
|
15221
|
+
<p class="small" style="margin-top:6mm">Technische Beobachtung zum angegebenen Zeitpunkt. Messwerte k\xF6nnen von Messung zu Messung schwanken, weil Werbetechnik nicht bei jedem Besuch gleich l\xE4dt; massgeblich ist, welche Anbieter betroffen sind, nicht die genaue Zahl der Anfragen. Keine Rechtsberatung und kein Zertifikat; \xABnicht beobachtet\xBB heisst nicht \xABnicht vorhanden\xBB. CuonzTech \xB7 Privacy Chaos Gate ${esc3(base.version)}.</p>
|
|
14361
15222
|
</body></html>`;
|
|
14362
15223
|
}
|
|
14363
15224
|
|
|
14364
|
-
// src/core/report/provenance.ts
|
|
14365
|
-
import { createHash } from "crypto";
|
|
14366
|
-
import fs10 from "fs/promises";
|
|
14367
|
-
import path10 from "path";
|
|
14368
|
-
var CPCG_VERSION = true ? "0.4.0" : "dev";
|
|
14369
|
-
function scanConfigOf(config) {
|
|
14370
|
-
return {
|
|
14371
|
-
targetUrl: config.targetUrl,
|
|
14372
|
-
scenarios: config.scenarios?.length ? [...config.scenarios].sort() : "alle",
|
|
14373
|
-
// Reihenfolge der Rechtsräume ändert die Prüfung nicht («EU,CH» = «CH,EU»).
|
|
14374
|
-
jurisdiction: config.jurisdiction.split(",").map((j) => j.trim()).filter(Boolean).sort().join(","),
|
|
14375
|
-
strict: config.strict,
|
|
14376
|
-
ignore: [...config.ignore].sort(),
|
|
14377
|
-
timeoutMs: config.timeoutMs,
|
|
14378
|
-
maxSubpages: config.maxSubpages,
|
|
14379
|
-
sitemap: config.sitemap,
|
|
14380
|
-
...config.sitemap ? { deepBudgetSeconds: config.deepBudgetSeconds, resume: Boolean(config.deepStateFile) } : {},
|
|
14381
|
-
bannerWaitSeconds: config.bannerWaitSeconds ?? null,
|
|
14382
|
-
acceptSelectors: config.acceptSelectors ?? [],
|
|
14383
|
-
rejectSelectors: config.rejectSelectors ?? [],
|
|
14384
|
-
settingsSelectors: config.settingsSelectors ?? [],
|
|
14385
|
-
bannerFrame: config.bannerFrame ?? null,
|
|
14386
|
-
headless: config.headless,
|
|
14387
|
-
// Besucherprofil und Ausgang gehören zur Prüfung; der Proxy nur ohne Zugangsdaten (zwei Ausgänge = zwei Konfigurationen).
|
|
14388
|
-
visitor: config.visitor ?? "ch",
|
|
14389
|
-
proxy: config.proxy ? redactProxy(config.proxy) : null,
|
|
14390
|
-
// Nur die Namen der Freigabe-Header: die Werte sind Geheimnisse.
|
|
14391
|
-
targetHeaders: Object.keys(config.targetHeaders ?? {}).sort()
|
|
14392
|
-
};
|
|
14393
|
-
}
|
|
14394
|
-
function canonicalJson(value) {
|
|
14395
|
-
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
14396
|
-
if (value && typeof value === "object") {
|
|
14397
|
-
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
14398
|
-
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
14399
|
-
}
|
|
14400
|
-
return JSON.stringify(value);
|
|
14401
|
-
}
|
|
14402
|
-
var sha256 = (data) => createHash("sha256").update(data).digest("hex");
|
|
14403
|
-
function buildProvenance(config, browser) {
|
|
14404
|
-
const scanConfig = scanConfigOf(config);
|
|
14405
|
-
return {
|
|
14406
|
-
tool: "cpcg",
|
|
14407
|
-
version: CPCG_VERSION,
|
|
14408
|
-
configHash: sha256(canonicalJson(scanConfig)),
|
|
14409
|
-
config: scanConfig,
|
|
14410
|
-
...browser ? { browser } : {},
|
|
14411
|
-
node: process.version,
|
|
14412
|
-
platform: `${process.platform}-${process.arch}`
|
|
14413
|
-
};
|
|
14414
|
-
}
|
|
14415
|
-
async function writeManifest(reportDir, base, files, meta) {
|
|
14416
|
-
const entries = [];
|
|
14417
|
-
for (const file of [...new Set(files.map((f) => path10.resolve(f)))].sort()) {
|
|
14418
|
-
const data = await fs10.readFile(file).catch(() => null);
|
|
14419
|
-
if (!data) continue;
|
|
14420
|
-
entries.push({ path: path10.relative(reportDir, file).split(path10.sep).join("/"), sha256: sha256(data), bytes: data.length });
|
|
14421
|
-
}
|
|
14422
|
-
const jsonPath = `${base}-manifest.json`;
|
|
14423
|
-
const sumPath = `${base}-manifest.sha256`;
|
|
14424
|
-
await fs10.writeFile(jsonPath, `${JSON.stringify({ tool: "cpcg", ...meta, files: entries }, null, 2)}
|
|
14425
|
-
`, "utf-8");
|
|
14426
|
-
await fs10.writeFile(sumPath, entries.map((e) => `${e.sha256} ${e.path}`).join("\n") + "\n", "utf-8");
|
|
14427
|
-
return { jsonPath, sumPath, entries };
|
|
14428
|
-
}
|
|
14429
|
-
var hostOf3 = (url) => {
|
|
14430
|
-
if (url.startsWith("cookie:")) return url.slice(url.lastIndexOf("@") + 1) || "cookie";
|
|
14431
|
-
try {
|
|
14432
|
-
return new URL(url).hostname;
|
|
14433
|
-
} catch {
|
|
14434
|
-
return "";
|
|
14435
|
-
}
|
|
14436
|
-
};
|
|
14437
|
-
function findingsOf(report) {
|
|
14438
|
-
const out = /* @__PURE__ */ new Map();
|
|
14439
|
-
for (const v of report.violations ?? []) {
|
|
14440
|
-
const ruleId = v.ruleId ?? "pre-consent-tracking";
|
|
14441
|
-
const host = hostOf3(v.requestUrl);
|
|
14442
|
-
const key = `${ruleId}|${v.trackerName}|${host}`;
|
|
14443
|
-
const cur = out.get(key);
|
|
14444
|
-
if (cur) {
|
|
14445
|
-
cur.count++;
|
|
14446
|
-
if (!cur.scenarios.includes(v.scenario)) cur.scenarios.push(v.scenario);
|
|
14447
|
-
cur.advisory &&= v.advisory === true;
|
|
14448
|
-
} else {
|
|
14449
|
-
out.set(key, { ruleId, trackerName: v.trackerName, host, scenarios: [v.scenario], count: 1, advisory: v.advisory === true });
|
|
14450
|
-
}
|
|
14451
|
-
}
|
|
14452
|
-
return out;
|
|
14453
|
-
}
|
|
14454
|
-
var ROUTE_SCENARIOS = /* @__PURE__ */ new Set(["subpage-spa", "consent-persistence"]);
|
|
14455
|
-
function recheckedIn(current, f) {
|
|
14456
|
-
const checked = new Set((current.evidence ?? []).filter((e) => e.status === "passed" || e.status === "suspicious").map((e) => e.scenario));
|
|
14457
|
-
if (!f.scenarios.every((s2) => checked.has(s2))) return false;
|
|
14458
|
-
const s = current.subpageSampling;
|
|
14459
|
-
const complete = s ? (s.checkedTotal ?? s.checked) >= s.linked && s.source !== "sitemap" : false;
|
|
14460
|
-
return !f.scenarios.some((sc) => ROUTE_SCENARIOS.has(sc)) || complete;
|
|
14461
|
-
}
|
|
14462
|
-
function compareReports(current, baseline) {
|
|
14463
|
-
const now = findingsOf(current);
|
|
14464
|
-
const before = findingsOf(baseline);
|
|
14465
|
-
const baseProv = baseline.provenance;
|
|
14466
|
-
const curProv = current.provenance;
|
|
14467
|
-
const statusOf = (r) => new Map((r.evidence ?? []).map((e) => [e.scenario, e.status]));
|
|
14468
|
-
const sBefore = statusOf(baseline);
|
|
14469
|
-
const scenarioChanges = [];
|
|
14470
|
-
for (const [scenario, after] of statusOf(current)) {
|
|
14471
|
-
const prev = sBefore.get(scenario);
|
|
14472
|
-
if (prev && prev !== after) scenarioChanges.push({ scenario, before: prev, after });
|
|
14473
|
-
}
|
|
14474
|
-
return {
|
|
14475
|
-
...baseline.scannedAt ? { baselineScannedAt: baseline.scannedAt } : {},
|
|
14476
|
-
...baseProv?.version ? { baselineVersion: baseProv.version } : {},
|
|
14477
|
-
sameTarget: baseline.targetUrl === current.targetUrl,
|
|
14478
|
-
...baseProv?.configHash && curProv?.configHash ? { sameConfig: baseProv.configHash === curProv.configHash } : {},
|
|
14479
|
-
...baseProv?.version && curProv?.version ? { sameVersion: baseProv.version === curProv.version } : {},
|
|
14480
|
-
newFindings: [...now].filter(([k]) => !before.has(k)).map(([, f]) => f),
|
|
14481
|
-
resolvedFindings: [...before].filter(([k]) => !now.has(k)).map(([, f]) => f).filter((f) => recheckedIn(current, f)),
|
|
14482
|
-
notRechecked: [...before].filter(([k]) => !now.has(k)).map(([, f]) => f).filter((f) => !recheckedIn(current, f)),
|
|
14483
|
-
unchangedFindings: [...now.keys()].filter((k) => before.has(k)).length,
|
|
14484
|
-
scenarioChanges
|
|
14485
|
-
};
|
|
14486
|
-
}
|
|
14487
|
-
var STATUSES = /* @__PURE__ */ new Set(["passed", "suspicious", "not-checkable", "not-applicable"]);
|
|
14488
|
-
var str = (v, max = 2e3) => typeof v === "string" && v.length <= max;
|
|
14489
|
-
async function loadBaseline(file) {
|
|
14490
|
-
const name = path10.basename(file);
|
|
14491
|
-
let raw;
|
|
14492
|
-
try {
|
|
14493
|
-
raw = await fs10.readFile(file, "utf-8");
|
|
14494
|
-
} catch (err) {
|
|
14495
|
-
return { error: `Vorlauf nicht lesbar (${err.code ?? "Fehler"}): ${name}` };
|
|
14496
|
-
}
|
|
14497
|
-
let parsed;
|
|
14498
|
-
try {
|
|
14499
|
-
parsed = JSON.parse(raw);
|
|
14500
|
-
} catch {
|
|
14501
|
-
return { error: `Vorlauf ist kein g\xFCltiges JSON: ${name}` };
|
|
14502
|
-
}
|
|
14503
|
-
if (!parsed || typeof parsed !== "object" || !str(parsed.targetUrl) || !Array.isArray(parsed.violations)) {
|
|
14504
|
-
return { error: `Vorlauf ist kein CPCG-Report (targetUrl/violations fehlen): ${name}` };
|
|
14505
|
-
}
|
|
14506
|
-
const rawViolations = parsed.violations;
|
|
14507
|
-
const violations = rawViolations.filter(
|
|
14508
|
-
(v) => v && typeof v === "object" && str(v.requestUrl) && str(v.trackerName, 300) && str(v.scenario, 100) && (v.ruleId === void 0 || str(v.ruleId, 100))
|
|
14509
|
-
);
|
|
14510
|
-
const evidence = (Array.isArray(parsed.evidence) ? parsed.evidence : []).filter(
|
|
14511
|
-
(e) => e && typeof e === "object" && str(e.scenario, 100) && typeof e.status === "string" && STATUSES.has(e.status)
|
|
14512
|
-
);
|
|
14513
|
-
const prov = parsed.provenance;
|
|
14514
|
-
const report = {
|
|
14515
|
-
...parsed,
|
|
14516
|
-
violations,
|
|
14517
|
-
evidence: evidence.map((e) => ({ scenario: e.scenario, status: e.status })),
|
|
14518
|
-
scannedAt: str(parsed.scannedAt, 100) ? parsed.scannedAt : void 0,
|
|
14519
|
-
provenance: prov && typeof prov === "object" && str(prov.configHash, 100) && str(prov.version, 100) ? { configHash: prov.configHash, version: prov.version } : void 0
|
|
14520
|
-
};
|
|
14521
|
-
const dropped = rawViolations.length - violations.length;
|
|
14522
|
-
return { report, ...dropped > 0 ? { dropped } : {} };
|
|
14523
|
-
}
|
|
14524
|
-
|
|
14525
15225
|
// src/core/report/shots.ts
|
|
14526
15226
|
import fs11 from "fs/promises";
|
|
14527
15227
|
import path11 from "path";
|
|
@@ -14631,7 +15331,9 @@ function limitedFactsOf(r) {
|
|
|
14631
15331
|
uncheckable: l.uncheckable,
|
|
14632
15332
|
scenariosTotal: l.scenariosTotal,
|
|
14633
15333
|
nothingToCheck: l.nothingToCheck ?? false,
|
|
14634
|
-
reason: l.reason
|
|
15334
|
+
reason: l.reason,
|
|
15335
|
+
...l.rejectWorks ? { rejectWorks: l.rejectWorks } : {},
|
|
15336
|
+
...l.preSelection ? { preSelection: l.preSelection } : {}
|
|
14635
15337
|
};
|
|
14636
15338
|
}
|
|
14637
15339
|
function visitStatusText(r) {
|
|
@@ -14876,7 +15578,7 @@ var PrivacyChaosGate = class {
|
|
|
14876
15578
|
missing.push({ visit: "eu", reason, detail: MISSING_TEXT[reason] });
|
|
14877
15579
|
} else {
|
|
14878
15580
|
console.log(pc.bold(pc.cyan(`
|
|
14879
|
-
\u25B6 Besuch aus der EU (\xFCber ${exit.source === "override" ? "
|
|
15581
|
+
\u25B6 Besuch aus der EU (\xFCber ${exit.source === "override" ? "deinen Proxy " + redactProxy(exit.url) : exit.source === "trial" ? "den EU-Ausgang von CuonzTech, Test-Zugang: ohne Lizenz nur Zahlen" : "den EU-Ausgang von CuonzTech"})`)));
|
|
14880
15582
|
if (ch?.remediation && (ch.remediation.pullRequest || ch.remediation.commitHash) && probe.autoFix) {
|
|
14881
15583
|
console.log(pc.dim("\u2139 Der Fix des Schweiz-Besuchs ist schon vorgeschlagen; der EU-Besuch wendet keinen weiteren Fix an. Befunde, die nur die EU zeigt, nach dem Merge in einem neuen Lauf pr\xFCfen."));
|
|
14882
15584
|
}
|
|
@@ -14960,7 +15662,7 @@ var PrivacyChaosGate = class {
|
|
|
14960
15662
|
if (!chFacts && !euFacts) return;
|
|
14961
15663
|
const pdfPath = `${out}-kurzergebnis.pdf`;
|
|
14962
15664
|
await renderCustomerPdf(
|
|
14963
|
-
buildLimitedVisitsPdfHtml(chFacts, euFacts, { targetUrl: c.probe.targetUrl, scannedAt, version: CPCG_VERSION }, { ch: c.ch?.exit ? { country: c.ch.exit.country, reliable: c.ch.exit.reliable } : void 0, eu: c.eu?.exit ? { country: c.eu.exit.country, reliable: c.eu.exit.reliable, full: c.eu.exit.full, note: c.eu.exit.note } : void 0 }, c.missing),
|
|
15665
|
+
buildLimitedVisitsPdfHtml(chFacts, euFacts, { targetUrl: c.probe.targetUrl, scannedAt, version: CPCG_VERSION, ...c.probe.schnelltest ? { schnelltest: true, maxSubpages: c.probe.maxSubpages } : {} }, { ch: c.ch?.exit ? { country: c.ch.exit.country, reliable: c.ch.exit.reliable } : void 0, eu: c.eu?.exit ? { country: c.eu.exit.country, reliable: c.eu.exit.reliable, full: c.eu.exit.full, note: c.eu.exit.note } : void 0 }, c.missing),
|
|
14964
15666
|
pdfPath,
|
|
14965
15667
|
CUSTOMER_FOOTER_TEMPLATE
|
|
14966
15668
|
);
|
|
@@ -15027,23 +15729,23 @@ var PrivacyChaosGate = class {
|
|
|
15027
15729
|
console.log(pc.bold(pc.cyan(" CUONZTECH PRIVACY CHAOS GATE (CPCG) ")));
|
|
15028
15730
|
console.log(pc.bold(pc.cyan("=======================================================\n")));
|
|
15029
15731
|
const row = (label, value) => console.log(pc.blue(`\u2139 ${label}:`.padEnd(24)), pc.white(value));
|
|
15030
|
-
row("
|
|
15031
|
-
row("Auto-Fix
|
|
15732
|
+
row("Ziel-URL", config.targetUrl);
|
|
15733
|
+
row("Auto-Fix", config.autoFix ? `true (Quellverzeichnis: ${path12.resolve(config.sourceDir)})` : "false");
|
|
15032
15734
|
row(
|
|
15033
15735
|
"LLM-Remediation",
|
|
15034
15736
|
config.llmRemediation ? `true (Provider: ${config.llmProvider})` : "false (Quellcode wird nicht an Dritte gesendet)"
|
|
15035
15737
|
);
|
|
15036
|
-
row("
|
|
15037
|
-
row("
|
|
15738
|
+
row("Bei Befund abbrechen", config.failOnLeak ? "ja (Exit 1)" : "nein");
|
|
15739
|
+
row("Bei Nicht-Pr\xFCfbarem", config.failOnUncheckable ? "Exit 4" : "Exit 0, Ergebnis bleibt unvollst\xE4ndig");
|
|
15038
15740
|
if (config.strict) row("Strict", "true (Hinweise blockieren ebenfalls)");
|
|
15039
15741
|
if (config.ignore.length > 0) row("Ignore", config.ignore.join(", "));
|
|
15040
|
-
row("
|
|
15742
|
+
row("Rechtsraum", config.jurisdiction);
|
|
15041
15743
|
{
|
|
15042
15744
|
const v = visitProfile(config.visitor);
|
|
15043
|
-
row("
|
|
15745
|
+
row("Besuch", `${v.label} (${v.locale}, ${v.timezoneId})${config.proxy ? `, \xFCber Proxy ${redactProxy(config.proxy)}` : ", ohne Proxy (IP dieses Rechners)"}`);
|
|
15044
15746
|
}
|
|
15045
|
-
if (config.targetHeaders) row("
|
|
15046
|
-
row("
|
|
15747
|
+
if (config.targetHeaders) row("Freigabe-Header", `${targetHeaderNames(config.targetHeaders).join(", ")} (Werte verborgen, nur an die Ziel-Origin)`);
|
|
15748
|
+
row("Bericht (JSON)", config.reportOutput);
|
|
15047
15749
|
console.log("");
|
|
15048
15750
|
const broadIgnore = forbiddenIgnorePatterns(config.ignore);
|
|
15049
15751
|
for (const p of broadIgnore) {
|
|
@@ -15072,7 +15774,7 @@ var PrivacyChaosGate = class {
|
|
|
15072
15774
|
assessment: assessReport(rep, config.scenarios, { strict: config.strict, jurisdictions: profiles })
|
|
15073
15775
|
};
|
|
15074
15776
|
};
|
|
15075
|
-
console.log(pc.bold(pc.yellow("\u25B6 Phase 1:
|
|
15777
|
+
console.log(pc.bold(pc.yellow("\u25B6 Phase 1: Pr\xFCfung l\xE4uft (Abl\xE4ufe mit Banner und Seite)...")));
|
|
15076
15778
|
const { report, blocking, assessment } = analyse(await scanner.scan(config));
|
|
15077
15779
|
probe.visitor = report.visitor;
|
|
15078
15780
|
if (limited) {
|
|
@@ -15112,7 +15814,7 @@ var PrivacyChaosGate = class {
|
|
|
15112
15814
|
for (const w of scannerWarnings) console.log(pc.yellow(`\u26A0 Scanner-Warnung: ${w}`));
|
|
15113
15815
|
const botProtection = report.botProtection;
|
|
15114
15816
|
if (botProtection) console.log(pc.bold(pc.yellow(`\u26A0 ${botProtectionText(botProtection)}`)));
|
|
15115
|
-
console.log(pc.bold(pc.yellow("\n\u25B6 Phase 2:
|
|
15817
|
+
console.log(pc.bold(pc.yellow("\n\u25B6 Phase 2: Auswertung...")));
|
|
15116
15818
|
const groups = assessment.findingGroups;
|
|
15117
15819
|
if (blocking.length > 0) {
|
|
15118
15820
|
console.log(
|
|
@@ -15122,7 +15824,7 @@ var PrivacyChaosGate = class {
|
|
|
15122
15824
|
const scenarios = new Set(
|
|
15123
15825
|
blocking.filter((v) => (v.ruleId ?? "pre-consent-tracking") === g.ruleId && v.trackerName === g.trackerName).map((v) => v.scenario)
|
|
15124
15826
|
);
|
|
15125
|
-
const unit = g.ruleId
|
|
15827
|
+
const unit = isBannerObservation(g.ruleId) ? "Beobachtung(en)" : "Request(s)";
|
|
15126
15828
|
console.log(pc.red(` [${g.ruleId}] ${g.trackerName}: ${g.count} ${unit} in ${scenariosText(scenarios.size)}`));
|
|
15127
15829
|
}
|
|
15128
15830
|
}
|
|
@@ -15479,7 +16181,9 @@ var PrivacyChaosGate = class {
|
|
|
15479
16181
|
scenariosTotal: assessment.scenariosTotal,
|
|
15480
16182
|
nothingToCheck,
|
|
15481
16183
|
reason: config.license?.reason === "invalid" || config.license?.reason === "unreachable" ? config.license.reason : "none",
|
|
15482
|
-
...config.license?.detail ? { detail: config.license.detail } : {}
|
|
16184
|
+
...config.license?.detail ? { detail: config.license.detail } : {},
|
|
16185
|
+
// Nur der Schnelltest zeigt diese beiden Werte (neutrales Kurzergebnis); sonst unverändert
|
|
16186
|
+
...config.schnelltest ? { rejectWorks: rejectWorksOf(blocking, report.evidence), preSelection: preSelectionOf(blocking) } : {}
|
|
15483
16187
|
};
|
|
15484
16188
|
console.log(pc.green(`\u2714 Scan abgeschlossen in ${report.durationMs} ms.`));
|
|
15485
16189
|
console.log(pc.bold(pc.cyan("\n-------------------------------------------------------")));
|
|
@@ -15505,7 +16209,7 @@ var PrivacyChaosGate = class {
|
|
|
15505
16209
|
try {
|
|
15506
16210
|
const pdfPath = out.replace(/.json$/i, "") + "-kurzergebnis.pdf";
|
|
15507
16211
|
await renderCustomerPdf(
|
|
15508
|
-
buildLimitedPdfHtml(facts, { targetUrl: config.targetUrl, scannedAt: report.scannedAt, version: CPCG_VERSION }),
|
|
16212
|
+
buildLimitedPdfHtml(facts, { targetUrl: config.targetUrl, scannedAt: report.scannedAt, version: CPCG_VERSION, ...config.schnelltest ? { schnelltest: true, maxSubpages: config.maxSubpages } : {} }),
|
|
15509
16213
|
pdfPath,
|
|
15510
16214
|
CUSTOMER_FOOTER_TEMPLATE
|
|
15511
16215
|
);
|
|
@@ -15539,7 +16243,22 @@ var PrivacyChaosGate = class {
|
|
|
15539
16243
|
});
|
|
15540
16244
|
}
|
|
15541
16245
|
const { groups, requests, scenarios, hints, uncheckable, scenariosTotal } = facts;
|
|
15542
|
-
return {
|
|
16246
|
+
return {
|
|
16247
|
+
status,
|
|
16248
|
+
exitCode,
|
|
16249
|
+
limited: {
|
|
16250
|
+
reason: facts.reason,
|
|
16251
|
+
groups,
|
|
16252
|
+
requests,
|
|
16253
|
+
scenarios,
|
|
16254
|
+
hints,
|
|
16255
|
+
uncheckable,
|
|
16256
|
+
scenariosTotal,
|
|
16257
|
+
nothingToCheck: facts.nothingToCheck,
|
|
16258
|
+
...facts.rejectWorks ? { rejectWorks: facts.rejectWorks } : {},
|
|
16259
|
+
...facts.preSelection ? { preSelection: facts.preSelection } : {}
|
|
16260
|
+
}
|
|
16261
|
+
};
|
|
15543
16262
|
}
|
|
15544
16263
|
printExitNotes(exitCode, incompleteText) {
|
|
15545
16264
|
if (exitCode === EXIT.OK) console.log(pc.yellow(" --fail-on-leak false: Exit 0 trotz Leaks."));
|
|
@@ -15596,7 +16315,7 @@ var PrivacyChaosGate = class {
|
|
|
15596
16315
|
}))
|
|
15597
16316
|
};
|
|
15598
16317
|
await fs12.writeFile(resolvedPath, JSON.stringify({ ...portable, gate: gateJson }, null, 2), "utf-8");
|
|
15599
|
-
console.log(pc.dim("
|
|
16318
|
+
console.log(pc.dim("Bericht (JSON) gespeichert: " + resolvedPath));
|
|
15600
16319
|
const written = [resolvedPath];
|
|
15601
16320
|
const evidenceDir = path12.join(dir, "evidence");
|
|
15602
16321
|
const shots = [];
|
|
@@ -15616,20 +16335,20 @@ var PrivacyChaosGate = class {
|
|
|
15616
16335
|
} catch {
|
|
15617
16336
|
}
|
|
15618
16337
|
}
|
|
15619
|
-
console.log(pc.dim("
|
|
16338
|
+
console.log(pc.dim("Bildschirmfotos kopiert nach: " + evidenceDir));
|
|
15620
16339
|
}
|
|
15621
16340
|
const client = entitled ? config.clientName : void 0;
|
|
15622
16341
|
const base = resolvedPath.replace(/\.json$/i, "");
|
|
15623
16342
|
const manifestName = report.provenance ? `${path12.basename(base)}-manifest.sha256` : void 0;
|
|
15624
16343
|
const mdPath = base + "-evidence.md";
|
|
15625
|
-
await fs12.writeFile(mdPath, buildEvidenceMarkdown(report, "
|
|
16344
|
+
await fs12.writeFile(mdPath, buildEvidenceMarkdown(report, "Nachweis-Bericht", { demo, gate, client, manifestName }), "utf-8");
|
|
15626
16345
|
written.push(mdPath);
|
|
15627
|
-
console.log(pc.dim("
|
|
16346
|
+
console.log(pc.dim("Nachweis (Markdown) gespeichert: " + mdPath));
|
|
15628
16347
|
const htmlPath = base + "-evidence.html";
|
|
15629
16348
|
const shotSources = await this.embeddableScreenshots(shots.map((x) => x.path));
|
|
15630
|
-
await fs12.writeFile(htmlPath, buildEvidenceHtml(report, "
|
|
16349
|
+
await fs12.writeFile(htmlPath, buildEvidenceHtml(report, "Nachweis-Bericht", { demo, gate, client, shotSources, manifestName }), "utf-8");
|
|
15631
16350
|
written.push(htmlPath);
|
|
15632
|
-
console.log(pc.dim("
|
|
16351
|
+
console.log(pc.dim("Nachweis (HTML) gespeichert: " + htmlPath));
|
|
15633
16352
|
if (config.reportPdf === true && entitled) {
|
|
15634
16353
|
try {
|
|
15635
16354
|
const model = buildCustomerReport(report, {
|
|
@@ -15643,7 +16362,7 @@ var PrivacyChaosGate = class {
|
|
|
15643
16362
|
const pdfPath = base + "-kundenbericht.pdf";
|
|
15644
16363
|
await renderCustomerPdf(renderCustomerReportHtml(model), pdfPath, CUSTOMER_FOOTER_TEMPLATE);
|
|
15645
16364
|
written.push(pdfPath);
|
|
15646
|
-
console.log(pc.dim("Kundenbericht (PDF)
|
|
16365
|
+
console.log(pc.dim("Kundenbericht (PDF) gespeichert: " + pdfPath));
|
|
15647
16366
|
} catch (err) {
|
|
15648
16367
|
console.log(pc.yellow("\u26A0 PDF-Erzeugung \xFCbersprungen: " + safeError(err, 100)));
|
|
15649
16368
|
}
|
|
@@ -15656,7 +16375,7 @@ var PrivacyChaosGate = class {
|
|
|
15656
16375
|
version: report.provenance.version,
|
|
15657
16376
|
scannedAt: report.scannedAt
|
|
15658
16377
|
});
|
|
15659
|
-
console.log(pc.dim(`Hash-Manifest (${m.entries.length} Datei(en))
|
|
16378
|
+
console.log(pc.dim(`Hash-Manifest (${m.entries.length} Datei(en)) gespeichert: ${m.sumPath}`));
|
|
15660
16379
|
} catch (err) {
|
|
15661
16380
|
console.log(pc.yellow("\u26A0 Hash-Manifest nicht geschrieben: " + safeError(err, 100)));
|
|
15662
16381
|
}
|
|
@@ -15895,7 +16614,10 @@ export {
|
|
|
15895
16614
|
ENV_FILE_KEYS_HELP,
|
|
15896
16615
|
isEnvKeyAllowedFromFile,
|
|
15897
16616
|
loadProjectEnv,
|
|
16617
|
+
withScheme,
|
|
15898
16618
|
parseGateConfig,
|
|
16619
|
+
SCHNELLTEST_MAX_SUBPAGES,
|
|
16620
|
+
withSchnelltestLimits,
|
|
15899
16621
|
resolveGateConfig,
|
|
15900
16622
|
isLoopbackTarget,
|
|
15901
16623
|
LICENSE_CONTACT,
|