37093ff9e3
Task #15 Stage 1.c-e — Browser-Matrix Backend-Integration: - _phase_c2_browser_matrix.py: ruft consent-tester /scan-matrix wenn env BROWSER_MATRIX=true, fuellt state["browser_matrix"] + state["browser_aggregate"] + state["browser_matrix_html"] - V2-Mail-Block: 🌐 Browser-Matrix Tabelle (Profile · Score · Sub-Scores PC/RR/BD · Bewertung) mit Worst-of-Header - Orchestrator ruft run_phase_c2 nach run_phase_c KNOWN: Stage 1.b (consent_scanner browser_profile-Param) bleibt zurueckgestellt (Datei in loc-exception, Hook-Patch verweigert). Stage 1.a-Shim laeuft im consent-tester — alle Profile aktuell auf Chromium, echte Engine-Diversitaet kommt mit 1.b. Task #17 TH-RETENTION-002 als B11 ai_retention_granularity_check: - Erkennt AI-Provider-Kontext (vertex/openai/anthropic/etc) - In +-800-char-Window: prueft ≥2 Datenkategorien aus Standard-Liste (Texteingaben/IP/Geraet/Session/Fehlerprotokoll/Zeitstempel) - Wenn 1 pauschale Speicherdauer + ≥2 Kategorien aber kein per-Kategorie-Differential → LOW - Smoke: Elli-Mock-DSE trifft LOW "AI-Speicherdauer pauschal" Task #18 Specialist-Agents Phase-1-Prototyp: - compliance/services/specialist_agents/__init__.py mit Architektur-Doku - impressum_agent.py: 9 Pflichtangaben § 5 TMG + § 1 DL-InfoV als Pattern-Registry (Name, Email, Telefon, HR, USt-IdNr, Vertretungsberechtigt, Aufsichtsbehoerde, Berufsangaben, OS-Link) - business_scope-aware (OS-Link nur fuer ecommerce, Aufsichtsbehoerde nur fuer regulated_profession/financial/insurance) - Phase-1 ist Pattern-Match-only (kein LLM), demonstriert die Schnittstelle. Phase 2 ersetzt Pattern durch System-Prompt + KB. - Smoke: minimal-Impressum triggert 4 Findings korrekt Task #7 B1 Playwright Mobile-Verifikation: - consent-tester/services/mobile_reachability_scanner.py: echte WebKit-launch + p.devices['iPhone 15'] preset + de-DE locale + Europe/Berlin timezone - Footer-Anchor-Suche via locator("footer >> text=/.../i") fuer 13 Reopen-Phrasen - Tap-Target-Boundingbox-Messung (Apple HIG / WCAG ≥44x44) - Click-Behavior: DOM-Modal-Snapshot vor/nach, erkennt CMP-Open - Output: has_anchor, anchor_text, tap_target_px, click_opens_cmp, engine_meta, screenshot_b64 (Footer-Crop wenn kein Anchor) - consent-tester/routes_mobile.py POST /scan-mobile-reachability - Backend _b1_wiring erweitert: ruft Mobile-Endpoint zuerst, Fallback auf statischen HTTP-Fetch. Mobile-Daten enrichen finding.mobile_playwright + Severity-Bump bei tap-target<44 / click-doesnt-open-CMP. KNOWN: WebKit-System-Libs sind im Dockerfile ergaenzt (Stage 1.a- Commit), greifen aber erst nach CI/CD-Rebuild des consent-tester. Bis dahin faellt B1 sauber auf statischen Fetch zurueck. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
97 lines
3.7 KiB
Python
97 lines
3.7 KiB
Python
"""B9 + B10 wiring — Multi-Entity-Impressum + Drittland-Mechanismus.
|
|
|
|
Runs after B6/B7/B8. Adds Findings into `state["extra_findings"]`
|
|
and re-renders the extra-block HTML.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import html
|
|
import logging
|
|
|
|
from compliance.services.ai_retention_granularity_check import (
|
|
check_ai_retention_granularity,
|
|
)
|
|
from compliance.services.impressum_multi_entity_check import (
|
|
check_multi_entity_impressum,
|
|
)
|
|
from compliance.services.transfer_mechanism_check import (
|
|
check_transfer_mechanism,
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def run_b9b10(state: dict) -> None:
|
|
extras = state.get("extra_findings") or []
|
|
new: list[dict] = []
|
|
new.extend(check_multi_entity_impressum(state))
|
|
new.extend(check_transfer_mechanism(state))
|
|
new.extend(check_ai_retention_granularity(state))
|
|
if not new:
|
|
return
|
|
extras.extend(new)
|
|
state["extra_findings"] = extras
|
|
state["extra_findings_html"] = _render(extras)
|
|
logger.info("B9/B10 added %d findings (total extra=%d)",
|
|
len(new), len(extras))
|
|
|
|
|
|
def _render(findings: list[dict]) -> str:
|
|
cards = []
|
|
for f in findings:
|
|
sev = (f.get("severity") or "").upper()
|
|
color = "#dc2626" if sev == "HIGH" else (
|
|
"#f59e0b" if sev == "MEDIUM" else "#64748b"
|
|
)
|
|
meta = ""
|
|
if f.get("entities_missing"):
|
|
meta = ("<div style='font-size:12px;color:#475569;margin-top:6px;'>"
|
|
f"<em>Fehlt bei: "
|
|
f"{html.escape(', '.join(f['entities_missing']))}</em>"
|
|
"</div>")
|
|
elif f.get("vendor"):
|
|
meta = ("<div style='font-size:12px;color:#475569;margin-top:6px;'>"
|
|
f"<em>Vendor: {html.escape(f['vendor'])} "
|
|
f"({html.escape(f.get('country','?'))})</em>"
|
|
"</div>")
|
|
elif f.get("doc_date"):
|
|
meta = ("<div style='font-size:12px;color:#475569;margin-top:6px;'>"
|
|
f"<em>Stand: {html.escape(f['doc_date'])} "
|
|
f"({f.get('age_years','?')} J. alt)</em>"
|
|
"</div>")
|
|
elif f.get("detected_provider"):
|
|
meta = ("<div style='font-size:12px;color:#475569;margin-top:6px;'>"
|
|
f"<em>Erkannter Provider: "
|
|
f"{html.escape(f['detected_provider'])}</em>"
|
|
"</div>")
|
|
elif f.get("evidence_dse"):
|
|
meta = ("<div style='font-size:12px;color:#475569;margin-top:6px;'>"
|
|
f"<em>In DSE: {html.escape(', '.join(f['evidence_dse']))}</em>"
|
|
"</div>")
|
|
cards.append(
|
|
f"<div style='margin:12px 0;padding:14px;background:#fff;"
|
|
f"border-left:3px solid {color};border-radius:4px;'>"
|
|
f"<div style='font-weight:600;color:{color};font-size:14px;'>"
|
|
f"{sev} · {html.escape(f.get('check_id') or '')}</div>"
|
|
f"<div style='font-size:14px;margin-top:4px;'>"
|
|
f"<strong>{html.escape(f.get('title') or '')}</strong></div>"
|
|
f"<div style='font-size:12px;color:#64748b;margin-top:2px;'>"
|
|
f"{html.escape(f.get('norm') or '')}</div>"
|
|
f"{meta}"
|
|
f"<div style='font-size:13px;margin-top:8px;background:#dcfce7;"
|
|
f"padding:8px 10px;border-radius:4px;'>"
|
|
f"<strong>→ Empfehlung:</strong> "
|
|
f"{html.escape(f.get('action') or '')}</div>"
|
|
"</div>"
|
|
)
|
|
return (
|
|
"<div style='margin:24px 0;padding:16px;border-left:4px solid #f59e0b;"
|
|
"background:#fffbeb;border-radius:4px;'>"
|
|
"<h2 style='margin:0 0 8px;color:#92400e;font-size:16px;'>"
|
|
"📌 Zusätzliche Cross-Doc-Befunde"
|
|
"</h2>"
|
|
+ "".join(cards) +
|
|
"</div>"
|
|
)
|