DSGVO Art. 9 — Compliance-Gap im Mail-Connect-Flow geschlossen (Hans-Müller-DSB
hat den Gap für Gmail/iCloud/GMX identifiziert, schon vor Outlook-OAuth-Pflicht):
- Schema: mail_connections.consent_at + consent_version + consent_ip_address;
neue consent_logs-Tabelle für Audit (grant + revoke append-only)
- Endpoints:
- POST /api/mail-connections/consent (Bulk-Array für Re-Consent, partial-fail
wirft sofort = DSGVO-sicher gegen silent-skip fremder IDs)
- POST /api/mail-connections/:id mit consent-gate (412 wenn consentVersion fehlt)
- DELETE /api/mail-connections/:id mit Widerruf-Log (OAuth-Token-Revoke als
TODO für mo Phase 2)
- GET /api/mail-connections/pending-consent — listet Bestands-Connections
mit consent_at=NULL für Re-Consent-Modal
- Account-Lösch-Bug fix: deleteAllMailConnections() war in user/delete nicht
eingebunden — Verbindungen blieben als Waisen
- Frontend:
- ConnectMailSheet: neuer Consent-Step VOR Provider-Grid (view-Machine
consent → grid → form), exakter Hans-Müller-Wortlaut für Art. 9 Abs. 2
lit. a Einwilligung
- MailConsentReminderSheet: Re-Consent-Modal beim App-Open für Bestands-User
- Stores mailConsent + mailConnectDraft (letzterer fixt Bug: Email/Provider
ging verloren wenn User Browser für App-Pw-Generierung öffnete)
- 12 neue i18n-Keys mail.consent.* in DE + EN
- Versionierter Consent-Text: art9-mail-v1-2026-05-13 (Bump bei Text-Änderung
triggert Re-Consent für alle)
Outlook-OAuth Schema (Phase 0 — additiv, Endpoints kommen später):
- mail_connections: auth_method (default 'app_password' → keine Bestands-
Connection bricht), oauth_access_token, oauth_refresh_token,
oauth_token_expiry, oauth_scope
- Encryption via bestehendes server/utils/crypto.ts (AES-256-GCM, Key aus
Infisical)
- Plan-Doc backend/docs/mail-outlook-oauth-plan.md (mo)
- DSB-Review backend/docs/mail-outlook-oauth-dsgvo-review.md (Hans-Müller):
MS als Sub-AV via DPA Sep 2025, EU Data Boundary seit Feb 2025; 5 Pflicht-
Aufgaben + Anwalts-Klärung zu DPA-Anspruch ohne MS-Lizenz
Profile — Cooldown-Pattern-Analysis als Collapsible:
- CooldownPatternAnalysis: 24h-Uhrzeit-Heatmap, Mo–So-Wochentag-Histogramm,
Top-5-Reason-Wortcloud mit Stop-Words-Filter, Cancel-Rate-Anzeige
- DiGA-relevant: NLP läuft client-side, reason-Texte verlassen das Device
nicht (gut für DSB-Akte)
- useProfileData: useCooldownHistoryFull (limit=100) für Pattern-Analyse
- Neutral formuliert, kein Stigma, alle Headings als Frage
Plan-Docs (kein Code):
- backend/docs/mail-custom-keywords-plan.md — Pro/Legend Custom-Keyword-Filter
(3.25 PT MVP, user-scoped, Body-Match in Phase 2)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
2.5 KiB
TypeScript
51 lines
2.5 KiB
TypeScript
/**
|
|
* Consent-Text-Versionierung — Art. 9 DSGVO (Gesundheitsdaten / Mail-Auto-Delete)
|
|
*
|
|
* WORKFLOW:
|
|
* 1. Hans-Müller (DSB) gibt neuen Text frei.
|
|
* 2. Neue Version hier eintragen, CURRENT_ART9_MAIL_VERSION bumpen.
|
|
* 3. Nach Migration: alle MailConnection.consentVersion !== CURRENT werden
|
|
* als "Re-Consent pending" behandelt (consentAt bleibt, aber Daemon pausiert).
|
|
* 4. Frontend zeigt Re-Consent-Modal beim App-Open (UI-Agent-Task).
|
|
*
|
|
* WICHTIG: Texts sind NICHT für LLM-Prompts — das ist reiner Compliance-Text.
|
|
* Formulierung liegt bei Hans-Müller (DSB) + Anwalt-Review.
|
|
* Dieser File ist Backend-Infrastruktur, kein Stil-File.
|
|
*/
|
|
|
|
export const CURRENT_ART9_MAIL_VERSION = "art9-mail-v1-2026-05-13";
|
|
|
|
interface ConsentTextEntry {
|
|
de: string;
|
|
en: string;
|
|
}
|
|
|
|
const CONSENT_TEXTS: Record<string, ConsentTextEntry> = {
|
|
"art9-mail-v1-2026-05-13": {
|
|
de: `Mit der Verbindung meines E-Mail-Postfachs willige ich ausdrücklich ein, dass Rebreak in meinem Postfach gezielt nach Glücksspiel-Werbemails sucht und diese löscht. Mir ist bewusst, dass aus dieser Verarbeitung Rückschlüsse auf eine Suchterkrankung möglich sind, und ich willige in diese Verarbeitung von Gesundheitsdaten gem. Art. 9 Abs. 2 lit. a DSGVO ausdrücklich ein. Diese Einwilligung kann ich jederzeit für die Zukunft widerrufen, indem ich die Mail-Verbindung in den Einstellungen trenne.`,
|
|
en: `By connecting my email mailbox, I expressly consent to Rebreak searching my mailbox for gambling promotional emails and deleting them. I am aware that this processing may allow inferences about an addiction disorder, and I expressly consent to the processing of health data pursuant to Art. 9(2)(a) GDPR. I may revoke this consent at any time with future effect by disconnecting the mail connection in the settings.`,
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Gibt den Consent-Text für eine gegebene Version zurück.
|
|
* Wirft wenn die Version unbekannt ist — das ist ein Programmierfehler,
|
|
* kein User-Fehler (Frontend sollte nie eine unbekannte Version schicken).
|
|
*/
|
|
export function getConsentText(version: string): ConsentTextEntry {
|
|
const entry = CONSENT_TEXTS[version];
|
|
if (!entry) {
|
|
throw new Error(
|
|
`Unknown consent version: "${version}". Known versions: ${Object.keys(CONSENT_TEXTS).join(", ")}`,
|
|
);
|
|
}
|
|
return entry;
|
|
}
|
|
|
|
/**
|
|
* Gibt alle bekannten Consent-Versionen zurück — für interne Konsistenz-Checks.
|
|
*/
|
|
export function getKnownConsentVersions(): string[] {
|
|
return Object.keys(CONSENT_TEXTS);
|
|
}
|