Skip to content

Latest commit

 

History

History
341 lines (260 loc) · 8.19 KB

File metadata and controls

341 lines (260 loc) · 8.19 KB
category 🛡️ Security/Compliance
version v1.3.0
status
date 22.12.2025

🔐 Compliance

GDPR, HIPAA, SOC2 Compliance für Enterprise-Anforderungen.

📋 Inhaltsverzeichnis

📋 Übersicht


Vollständige DSGVO/eIDAS/HGB-konforme Datenverarbeitung für hochsensible Anwendungen.

🎯 Features

Feature Beschreibung Status
Data Governance Klassifizierung (offen/vs-nfd/geheim/streng_geheim) ✅ Produktiv
PII Detection Automatische Erkennung von 7+ PII-Typen ✅ Produktiv
Audit Logging Encrypt-then-Sign mit PKI ✅ Produktiv
Retention Management Automatische Archivierung & Löschung ✅ Produktiv
Field Encryption AES-256-GCM für sensitive Felder ✅ Produktiv

🚀 Quickstart

1. Server starten

cd build/Release
./themis_server.exe --config ../../config/config.json

2. Retention aktivieren

// config/config.json
{
  "features": {
    "retention": {
      "enabled": true,
      "interval_hours": 24,
      "policies_path": "./config/retention_policies.yaml"
    }
  }
}

3. Demo ausführen

python demo_compliance.py

📋 Compliance-Matrix

DSGVO

Artikel Anforderung Umsetzung
Art. 5 Datenminimierung PII-Detection + Auto-Redaction
Art. 17 Recht auf Vergessenwerden Auto-Purge nach Retention-Period
Art. 25 Privacy by Design Verschlüsselung per Governance-Policy
Art. 30 Verzeichnis der Verarbeitungstätigkeiten Audit-Logs (Encrypt-then-Sign)
Art. 32 Sicherheit der Verarbeitung AES-256-GCM + PKI + TLS

eIDAS

Komponente Funktion Status
Qualifizierte Signatur PKI-Client (RSA-SHA256) Produktiv (mit ENV-Konfiguration) / ⚙️ Stub (ohne ENV)
Zeitstempel Präzise Zeiterfassung
Langzeitarchivierung Archive-Handler (S3/Tape) ⚙️ Konfigurierbar
Nachweisbarkeit Tamper-proof Audit-Logs ✅ Mit konfiguriertem PKI

✅ PKI Update (Nov 2025): Die PKI-Implementierung (src/utils/pki_client.cpp) unterstützt jetzt echte RSA-Signaturen via OpenSSL. Produktiv eIDAS-konform wenn ENV-Variablen gesetzt sind (THEMIS_PKI_PRIVATE_KEY, THEMIS_PKI_CERTIFICATE). Ohne ENV läuft Stub-Modus (Base64, nur Development). Details: docs/security/pki_rsa_integration.md.

HGB §257

Dokument Aufbewahrungsfrist Policy
Geschäftsbriefe 6 Jahre transaction_logs
Buchungsbelege 10 Jahre accounting_records
Inventare 10 Jahre inventory

🔐 Security-Features

1. Verschlüsselung

  • At-Rest: AES-256-GCM für sensitive Felder
  • In-Transit: TLS 1.3 (empfohlen)
  • Key-Management: Vault-Integration (optional)

2. Audit-Trail

// Beispiel: Audit-Event
{
  "action": "DATA_ACCESS",
  "user_id": "user_123",
  "entity_id": "patient_456",
  "classification": "geheim",
  "timestamp": 1730505600,
  "ip_address": "192.168.1.42"
}

Jedes Event wird:

  1. Verschlüsselt (AES-256-GCM)
  2. Signiert (RSA-SHA256 via PKI)
  3. Persistent geloggt (JSONL)

3. PII-Detection

Unterstützte Typen:

  • ✅ Email (RFC 5322)
  • ✅ Telefon (International + US)
  • ✅ SSN (US Social Security)
  • ✅ Kreditkarte (Luhn-validiert)
  • ✅ IBAN (DE/EU)
  • ✅ IP-Adresse (IPv4)
  • ✅ URL (HTTP/HTTPS)

⚙️ Konfiguration

Governance-Policies

# Automatisch via HTTP-Header
X-Data-Classification: geheim
X-Governance-Mode: enforce
Klassifizierung Verschlüsselung ANN-Indexing Retention Cache
offen 30d
vs-nfd 365d
geheim 90d
streng_geheim 30d

Retention-Policies

# config/retention_policies.yaml
policies:
  - name: user_personal_data
    retention_period: 365d
    archive_after: 180d
    auto_purge_enabled: true
    classification_level: geheim

PII-Detection

# config/pii_detection.yaml
engines:
  - name: regex_engine
    type: regex
    enabled: true
    patterns:
      - type: CREDIT_CARD
        pattern: '\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b'
        validate_luhn: true

📊 Tests

Alle Compliance-Tests ausführen

cd build
ctest -C Release -R "Governance|PIIDetector|Retention" --output-on-failure

Erwartetes Ergebnis:

100% tests passed, 0 tests failed out of 48

Test-Coverage

Komponente Tests Coverage
Governance 15 100%
PII-Detection 19 100%
Retention 14 100%
Audit-Logging 3 100%

🔧 Integration

Beispiel: DSGVO-konforme API

#include "utils/pii_detector.h"
#include "utils/audit_logger.h"
#include "utils/retention_manager.h"

// 1. PII-Detection
vcc::PIIDetector pii_detector("./config/pii_detection.yaml");
auto findings = pii_detector.detectInJson(request_body);

// 2. Governance-Check
if (classification == "geheim" && !encryption_enabled) {
    return error("Encryption required for geheim classification");
}

// 3. Audit-Logging
nlohmann::json audit_event;
audit_event["action"] = "DATA_CREATE";
audit_event["user_id"] = user_id;
audit_event["classification"] = classification;
audit_logger->logEvent(audit_event);

// 4. Verschlüsselte Speicherung
for (const auto& finding : findings) {
    if (finding.type == PIIType::CREDIT_CARD) {
        EncryptedField<std::string> encrypted(key_provider, "entity_key");
        encrypted.encrypt(finding.value);
        entity.setField("credit_card_encrypted", encrypted.toBase64());
    }
}

// 5. Retention-Metadata
entity.setField("_classification", classification);
entity.setField("_created_at", std::time(nullptr));

📈 Monitoring

Metriken (Prometheus)

themis_governance_requests_total{classification="geheim"} 1523
themis_pii_detections_total{type="CREDIT_CARD"} 234
themis_retention_archived_total 42
themis_retention_purged_total 18
themis_audit_events_total 3456

Log-Analyse

# Retention-Statistik
grep "Retention.*Completed" logs/themis_server.log | tail -1

# PII-Detections pro Tag
grep "PII_DETECTED" data/logs/audit.jsonl | \
  jq -r '.timestamp' | \
  xargs -I{} date -d @{} +%Y-%m-%d | \
  sort | uniq -c

# Klassifizierungs-Verteilung
grep "classification" data/logs/audit.jsonl | \
  jq -r '.classification' | \
  sort | uniq -c

🐛 Troubleshooting

Problem: Retention läuft nicht

Symptom: Keine Logs wie [Retention] Completed

Lösung:

// config/config.json
{
  "features": {
    "retention": {
      "enabled": true  // <- Prüfen!
    }
  }
}

Problem: PII nicht erkannt

Symptom: Kreditkarte wird nicht als PII markiert

Lösung: Luhn-Validierung aktivieren

patterns:
  - type: CREDIT_CARD
    validate_luhn: true  // <- Wichtig!

Problem: Audit-Log plaintext

Symptom: Klartext in audit.jsonl

Lösung:

AuditLoggerConfig cfg;
cfg.encrypt_then_sign = true;  // <- Aktivieren!

📚 Dokumentation

🤝 Support

  • Issues: GitHub Issues
  • Dokumentation: docs/ Verzeichnis
  • Demo: python demo_compliance.py

📝 Changelog

v0.1.0 (2025-11-01)

  • ✅ Data Governance (4 Klassifizierungsstufen)
  • ✅ PII Detection (7 Typen, YAML-konfigurierbar)
  • ✅ Audit Logging (Encrypt-then-Sign)
  • ✅ Retention Management (YAML-Policies, Auto-Purge)
  • ✅ Field Encryption (AES-256-GCM)
  • ✅ 48 Unit-Tests (100% Pass)

License: Proprietary
Maintainer: Themis Compliance Team
Version: 0.1.0