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>
117 lines
3.8 KiB
Python
117 lines
3.8 KiB
Python
"""B11 — AI-Retention-Granularity-Check (TH-RETENTION-002).
|
|
|
|
DSGVO Art. 13 Abs. 2 lit. a + DSK-Empfehlung: pro Datenkategorie
|
|
eine spezifische Speicherdauer. Eine pauschale Angabe wie
|
|
"6 Monate für alle Daten" reicht nicht.
|
|
|
|
GT-Pattern Elli:
|
|
Vertex-AI-Chatbot speichert "IT- und pseudonymisierte
|
|
Nutzungsdaten" pauschal 6 Monate. Keine Abstufung nach
|
|
Datenkategorie (Texteingaben / IP / Geräteinformationen /
|
|
Session-ID / Fehlerprotokolle).
|
|
|
|
Heuristik:
|
|
1. AI-Kontext erkennen (vertex ai / openai / claude / etc.)
|
|
2. In ±600-char-Window prüfen:
|
|
- Existiert eine Speicherdauer-Aussage? (parse_duration_to_days)
|
|
- Werden ≥2 Datenkategorien aus AI-Standardliste genannt?
|
|
(Texteingaben, IP, Geräteinformationen, Session, Fehlerprotokolle)
|
|
- Wenn 1 Speicherdauer + ≥2 Kategorien aber kein
|
|
per-Kategorie-Differential → LOW
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import re
|
|
|
|
from .retention_comparator import parse_duration_to_days
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
_AI_PROVIDERS = (
|
|
"vertex ai", "google vertex", "openai", "gpt-3", "gpt-4", "chatgpt",
|
|
"anthropic", "claude.ai", "claude-3", "mistral ai",
|
|
"ki-assistent", "ki assistent", "ai assistant",
|
|
)
|
|
|
|
|
|
_AI_DATA_CATEGORIES = (
|
|
"texteingab", # Texteingaben / Texteingabe
|
|
"chatverlauf", "chatverläuf",
|
|
"ip-adress",
|
|
"geräteinform", "geraeteinform", "device-info",
|
|
"session-id", "sitzungs-id",
|
|
"browserversion", "user-agent",
|
|
"fehlerprotokoll",
|
|
"zeitstempel",
|
|
)
|
|
|
|
|
|
def _per_category_phrases() -> tuple[str, ...]:
|
|
"""Patterns indicating per-category retention is mentioned."""
|
|
return (
|
|
"pro datenkategorie",
|
|
"je datenkategorie",
|
|
"unterschiedlich je",
|
|
"abhängig vom datentyp",
|
|
"abhaengig vom datentyp",
|
|
"differenziert nach",
|
|
"pro kategorie",
|
|
)
|
|
|
|
|
|
def check_ai_retention_granularity(state: dict) -> list[dict]:
|
|
doc_texts = state.get("doc_texts") or {}
|
|
dse = (doc_texts.get("dse") or "").lower()
|
|
if not dse:
|
|
return []
|
|
findings: list[dict] = []
|
|
for ai_kw in _AI_PROVIDERS:
|
|
idx = dse.find(ai_kw)
|
|
if idx < 0:
|
|
continue
|
|
window = dse[max(0, idx - 800): idx + 800]
|
|
if not window:
|
|
continue
|
|
categories_found = [c for c in _AI_DATA_CATEGORIES if c in window]
|
|
if len(categories_found) < 2:
|
|
continue
|
|
# Per-category retention phrase already present? then OK
|
|
if any(p in window for p in _per_category_phrases()):
|
|
return []
|
|
# Retention-claim in window? parse duration
|
|
m = re.search(
|
|
r"(\d+(?:[.,]\d+)?\s*(?:tage?|monat\w*|jahre?|"
|
|
r"day|month|year))", window,
|
|
)
|
|
if not m:
|
|
continue
|
|
days, kind = parse_duration_to_days(m.group(1))
|
|
if days is None:
|
|
continue
|
|
findings.append({
|
|
"check_id": "TH-RETENTION-GRANULARITY-001",
|
|
"severity": "LOW",
|
|
"severity_reason": "incomplete",
|
|
"title": (
|
|
"AI-Speicherdauer pauschal — pro Datenkategorie "
|
|
"differenzieren empfohlen"
|
|
),
|
|
"norm": "DSGVO Art. 13 Abs. 2 lit. a + DSK-OH AI",
|
|
"ai_provider": ai_kw,
|
|
"retention_days": int(days),
|
|
"categories_detected": categories_found,
|
|
"action": (
|
|
f"Für '{ai_kw}'-Kontext separate Speicherdauern je "
|
|
f"Datenkategorie angeben (Texteingaben / IP / "
|
|
f"Geräteinformationen / Session). Aktuell pauschal "
|
|
f"{int(days)} Tage."
|
|
),
|
|
})
|
|
break # one per DSE is enough
|
|
if findings:
|
|
logger.info("B11 AI-retention-granularity: %d findings", len(findings))
|
|
return findings
|