feat(training+controls): interactive video pipeline, training blocks, control generator, CE libraries
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Failing after 37s
CI/CD / test-python-backend-compliance (push) Successful in 39s
CI/CD / test-python-document-crawler (push) Successful in 26s
CI/CD / test-python-dsms-gateway (push) Successful in 23s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Has been skipped
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Failing after 37s
CI/CD / test-python-backend-compliance (push) Successful in 39s
CI/CD / test-python-document-crawler (push) Successful in 26s
CI/CD / test-python-dsms-gateway (push) Successful in 23s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Has been skipped
Interactive Training Videos (CP-TRAIN): - DB migration 022: training_checkpoints + checkpoint_progress tables - NarratorScript generation via Anthropic (AI Teacher persona, German) - TTS batch synthesis + interactive video pipeline (slides + checkpoint slides + FFmpeg) - 4 new API endpoints: generate-interactive, interactive-manifest, checkpoint submit, checkpoint progress - InteractiveVideoPlayer component (HTML5 Video, quiz overlay, seek protection, progress tracking) - Learner portal integration with automatic completion on all checkpoints passed - 30 new tests (handler validation + grading logic + manifest/progress + seek protection) Training Blocks: - Block generator, block store, block config CRUD + preview/generate endpoints - Migration 021: training_blocks schema Control Generator + Canonical Library: - Control generator routes + service enhancements - Canonical control library helpers, sidebar entry - Citation backfill service + tests - CE libraries data (hazard, protection, evidence, lifecycle, components) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,13 +37,21 @@ Wir benoetigen ein System, um aus verschiedenen Security-Guidelines **eigenstaen
|
||||
| Domain | Name | Beschreibung |
|
||||
|--------|------|-------------|
|
||||
| AUTH | Identity & Access Management | Authentisierung, MFA, Token-Management |
|
||||
| NET | Network & Transport Security | TLS, Zertifikate, Netzwerk-Haertung |
|
||||
| SUP | Software Supply Chain | Signierung, SBOM, Dependency-Scanning |
|
||||
| LOG | Security Operations & Logging | Privacy-Aware Logging, SIEM |
|
||||
| WEB | Web Application Security | Admin-Flows, Account Recovery |
|
||||
| DATA | Data Governance & Classification | Datenklassifikation, Schutzmassnahmen |
|
||||
| CRYP | Cryptographic Operations | Key Management, Rotation, HSM |
|
||||
| REL | Release & Change Governance | Change Impact Assessment, Security Review |
|
||||
| NET | Network & Transport Security | TLS, Zertifikate, Netzwerk-Haertung |
|
||||
| DATA | Data Governance & Classification | Datenklassifikation, Schutzmassnahmen |
|
||||
| LOG | Security Operations & Logging | Privacy-Aware Logging, SIEM |
|
||||
| ACC | Access Control | Zugriffskontrolle, Berechtigungen |
|
||||
| SEC | IT Security | Schwachstellen, Haertung, Konfiguration |
|
||||
| INC | Incident Management | Vorfallmanagement, Wiederherstellung |
|
||||
| AI | Artificial Intelligence | KI-Compliance, Bias, Transparenz |
|
||||
| COMP | Compliance | Konformitaet, Audit, Zertifizierung |
|
||||
| GOV | Government & Public Administration | Behoerden, Verwaltung, Aufsicht |
|
||||
| LAB | Labor Law | Arbeitsrecht, Arbeitsschutz, Betriebsverfassung |
|
||||
| FIN | Financial Regulation | Finanzregulierung, Rechnungslegung, BaFin |
|
||||
| TRD | Trade Regulation | Gewerbe, Handelsrecht, Produktsicherheit |
|
||||
| ENV | Environmental | Umweltschutz, Nachhaltigkeit, Emissionen |
|
||||
| HLT | Health | Gesundheit, Medizinprodukte, Hygiene |
|
||||
|
||||
!!! warning "Keine BSI-Nomenklatur"
|
||||
Die Domains verwenden bewusst KEINE BSI-Bezeichner (O.Auth_*, O.Netz_*).
|
||||
@@ -123,6 +131,8 @@ erDiagram
|
||||
| `GET` | `/v1/canonical/generate/processed-stats` | Verarbeitungsstatistik pro Collection |
|
||||
| `GET` | `/v1/canonical/generate/review-queue` | Controls zur Pruefung |
|
||||
| `POST` | `/v1/canonical/generate/review/{control_id}` | Review abschliessen |
|
||||
| `POST` | `/v1/canonical/generate/bulk-review` | Bulk-Review (approve/reject nach State) |
|
||||
| `POST` | `/v1/canonical/generate/qa-reclassify` | QA-Reklassifizierung bestehender Controls |
|
||||
| `GET` | `/v1/canonical/blocked-sources` | Gesperrte Quellen (Rule 3) |
|
||||
| `POST` | `/v1/canonical/blocked-sources/cleanup` | Cleanup-Workflow starten |
|
||||
|
||||
@@ -231,25 +241,28 @@ Der Validator (`scripts/validate-controls.py`) prueft bei jedem Commit:
|
||||
|
||||
## Control Generator Pipeline
|
||||
|
||||
Automatische Generierung von Controls aus dem gesamten RAG-Korpus (~183.000 Chunks aus Gesetzen, Verordnungen und Standards).
|
||||
Aktueller Stand: **~2.120 Controls** generiert.
|
||||
Automatische Generierung von Controls aus dem gesamten RAG-Korpus (~105.000 Chunks aus Gesetzen, Verordnungen und Standards).
|
||||
Aktueller Stand: **~4.738 Controls** generiert.
|
||||
|
||||
### 8-Stufen-Pipeline
|
||||
### 9-Stufen-Pipeline
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[1. RAG Scroll] -->|Alle Chunks| B[2. Prefilter - Lokales LLM]
|
||||
A[1. RAG Scroll] -->|max_chunks| B[2. Prefilter - Lokales LLM]
|
||||
B -->|Irrelevant| C[Als processed markieren]
|
||||
B -->|Relevant| D[3. License Classify]
|
||||
D -->|Batch sammeln| E[4. Batch Processing - 5 Chunks/API-Call]
|
||||
E -->|Rule 1/2| F[4a. Structure Batch - Anthropic]
|
||||
E -->|Rule 3| G[4b. Reform Batch - Anthropic]
|
||||
F --> H[5. Harmonization - Embeddings]
|
||||
G --> H
|
||||
F --> QA[5. QA Validation - Lokales LLM]
|
||||
G --> QA
|
||||
QA -->|Mismatch| QAF[Auto-Fix Category/Domain]
|
||||
QA -->|OK| H[6. Harmonization - Embeddings]
|
||||
QAF --> H
|
||||
H -->|Duplikat| I[Als Duplikat speichern]
|
||||
H -->|Neu| J[6. Anchor Search]
|
||||
J --> K[7. Store Control]
|
||||
K --> L[8. Mark Processed]
|
||||
H -->|Neu| J[7. Anchor Search]
|
||||
J --> K[8. Store Control]
|
||||
K --> L[9. Mark Processed]
|
||||
```
|
||||
|
||||
### Stufe 1: RAG Scroll (Vollstaendig)
|
||||
@@ -343,12 +356,64 @@ except Exception as e:
|
||||
Die `batch_size` ist ueber `GeneratorConfig` konfigurierbar.
|
||||
Bei grosser Batch-Size steigt die Wahrscheinlichkeit fuer Parsing-Fehler.
|
||||
|
||||
### Stufe 5: Harmonisierung (Embedding-basiert)
|
||||
### Stufe 5: QA Validation (Automatische Qualitaetspruefung)
|
||||
|
||||
Die QA-Stufe validiert die Klassifizierung jedes Controls automatisch. Sie vergleicht die LLM-Klassifizierung mit Keyword-basierter Erkennung und loest bei Abweichungen eine Arbitrierung durch das lokale Ollama-Modell aus.
|
||||
|
||||
#### Ablauf
|
||||
|
||||
1. **LLM-Category auswerten:** Der Anthropic-Prompt fragt jetzt explizit nach `category` und `domain`
|
||||
2. **Keyword-Detection als Cross-Check:** `_detect_category(chunk.text)` liefert eine zweite Meinung
|
||||
3. **Stimmen beide ueberein?** → Kein QA noetig (schneller Pfad)
|
||||
4. **Bei Disagreement:** Lokales LLM (Ollama qwen3.5:35b-a3b) arbitriert
|
||||
5. **Auto-Fix:** Bei hoher Konfidenz wird Category/Domain automatisch korrigiert
|
||||
|
||||
#### Beispiel
|
||||
|
||||
```
|
||||
Control: "Offenlegung von Risikokonzentrationen bei Finanzinstrumenten"
|
||||
LLM sagt: domain=AUTH, category=authentication
|
||||
Keyword sagt: domain=FIN, category=finance
|
||||
→ QA via Ollama: domain=FIN, category=finance (Grund: IFRS-Thema)
|
||||
→ Auto-Fix: AUTH-315 → FIN-xxx
|
||||
```
|
||||
|
||||
#### QA-Metriken in generation_metadata
|
||||
|
||||
```json
|
||||
{
|
||||
"qa_category_fix": {"from": "authentication", "to": "finance", "reason": "IFRS-Thema"},
|
||||
"qa_domain_fix": {"from": "AUTH", "to": "FIN", "reason": "Finanzregulierung"}
|
||||
}
|
||||
```
|
||||
|
||||
#### QA-Reklassifizierung bestehender Controls
|
||||
|
||||
Fuer bereits generierte Controls gibt es den Backfill-Endpoint:
|
||||
|
||||
```bash
|
||||
# Dry Run: Welche AUTH-Controls sind falsch klassifiziert?
|
||||
curl -X POST https://macmini:8002/api/compliance/v1/canonical/generate/qa-reclassify \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"limit": 50, "dry_run": true, "filter_domain_prefix": "AUTH"}'
|
||||
|
||||
# Korrekturen anwenden:
|
||||
curl -X POST https://macmini:8002/api/compliance/v1/canonical/generate/qa-reclassify \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"limit": 50, "dry_run": false, "filter_domain_prefix": "AUTH"}'
|
||||
```
|
||||
|
||||
!!! info "Performance"
|
||||
Die QA-Stufe nutzt das lokale Ollama-Modell (kostenlos, ~2s/Control).
|
||||
Sie wird nur bei Disagreement zwischen LLM und Keyword getriggert (~10-15% der Controls),
|
||||
sodass der Overhead minimal bleibt.
|
||||
|
||||
### Stufe 6: Harmonisierung (Embedding-basiert)
|
||||
|
||||
Prueft per bge-m3 Embeddings (Cosine Similarity > 0.85), ob ein aehnliches Control existiert.
|
||||
Embeddings werden in Batches vorgeladen (32 Texte/Request) fuer maximale Performance.
|
||||
|
||||
### Stufe 6-8: Anchor Search, Store, Mark Processed
|
||||
### Stufe 7-9: Anchor Search, Store, Mark Processed
|
||||
|
||||
- **Anchor Search:** Findet Open-Source-Referenzen (OWASP, NIST, ENISA)
|
||||
- **Store:** Persistiert Control mit `verification_method` und `category`
|
||||
@@ -358,6 +423,12 @@ Embeddings werden in Batches vorgeladen (32 Texte/Request) fuer maximale Perform
|
||||
|
||||
Bei der Generierung werden automatisch zugewiesen:
|
||||
|
||||
**Category** wird seit 2026-03-16 **dreigleisig** bestimmt:
|
||||
|
||||
1. **LLM-Klassifikation (primaer):** Anthropic liefert `category` im JSON-Response
|
||||
2. **Keyword-Detection (fallback):** Falls LLM keine Category liefert, greift `_detect_category()`
|
||||
3. **QA-Arbitrierung (bei Mismatch):** Lokales LLM entscheidet bei Widerspruch
|
||||
|
||||
**Verification Method** (Nachweis-Methode):
|
||||
|
||||
| Methode | Beschreibung |
|
||||
@@ -367,10 +438,33 @@ Bei der Generierung werden automatisch zugewiesen:
|
||||
| `tool` | Tool-basierte Pruefung |
|
||||
| `hybrid` | Kombination mehrerer Methoden |
|
||||
|
||||
**Category** (17 thematische Kategorien):
|
||||
encryption, authentication, network, data_protection, logging, incident,
|
||||
continuity, compliance, supply_chain, physical, personnel, application,
|
||||
system, risk, governance, hardware, identity
|
||||
**Category** (22 thematische Kategorien):
|
||||
|
||||
| Kategorie | Beschreibung |
|
||||
|-----------|-------------|
|
||||
| `encryption` | Verschluesselung, Kryptographie |
|
||||
| `authentication` | Authentifizierung, Login, MFA |
|
||||
| `network` | Netzwerk, Firewall, VPN |
|
||||
| `data_protection` | Datenschutz, DSGVO |
|
||||
| `logging` | Protokollierung, Monitoring |
|
||||
| `incident` | Vorfallmanagement |
|
||||
| `continuity` | Business Continuity, Backup |
|
||||
| `compliance` | Konformitaet, Audit, Zertifizierung |
|
||||
| `supply_chain` | Lieferkette, Dienstleister |
|
||||
| `physical` | Physische Sicherheit |
|
||||
| `personnel` | Schulung, Mitarbeiter |
|
||||
| `application` | Software, Code Review, API |
|
||||
| `system` | Haertung, Patch, Konfiguration |
|
||||
| `risk` | Risikobewertung, -management |
|
||||
| `governance` | Sicherheitsorganisation, Richtlinien |
|
||||
| `hardware` | Hardware, Firmware, TPM |
|
||||
| `identity` | IAM, SSO, Verzeichnisdienste |
|
||||
| `public_administration` | Behoerden, Verwaltung |
|
||||
| `labor_law` | Arbeitsrecht, Arbeitsschutz |
|
||||
| `finance` | Finanzregulierung, Rechnungslegung |
|
||||
| `trade_regulation` | Gewerbe, Handelsrecht |
|
||||
| `environmental` | Umweltschutz, Nachhaltigkeit |
|
||||
| `health` | Gesundheit, Medizinprodukte |
|
||||
|
||||
### Konfiguration
|
||||
|
||||
@@ -379,7 +473,7 @@ system, risk, governance, hardware, identity
|
||||
| `ANTHROPIC_API_KEY` | — | API-Key fuer Anthropic Claude |
|
||||
| `CONTROL_GEN_ANTHROPIC_MODEL` | `claude-sonnet-4-6` | Anthropic-Modell fuer Formulierung |
|
||||
| `OLLAMA_URL` | `http://host.docker.internal:11434` | Lokaler Ollama-Server (Vorfilter) |
|
||||
| `CONTROL_GEN_OLLAMA_MODEL` | `qwen3:30b-a3b` | Lokales LLM fuer Vorfilter |
|
||||
| `CONTROL_GEN_OLLAMA_MODEL` | `qwen3.5:35b-a3b` | Lokales LLM fuer Vorfilter + QA |
|
||||
| `CONTROL_GEN_LLM_TIMEOUT` | `180` | Timeout in Sekunden (erhoet fuer Batch-Calls) |
|
||||
|
||||
**Pipeline-Konfiguration (via `GeneratorConfig`):**
|
||||
@@ -388,6 +482,7 @@ system, risk, governance, hardware, identity
|
||||
|-----------|---------|-------------|
|
||||
| `batch_size` | `5` | Chunks pro Anthropic-API-Call |
|
||||
| `max_controls` | `0` | Limit (0 = alle Chunks verarbeiten) |
|
||||
| `max_chunks` | `1000` | Max Chunks pro Job (respektiert Dokumentgrenzen) |
|
||||
| `skip_processed` | `true` | Bereits verarbeitete Chunks ueberspringen |
|
||||
| `dry_run` | `false` | Trockenlauf ohne DB-Schreibzugriffe |
|
||||
| `skip_web_search` | `false` | Web-Suche fuer Anchor-Finder ueberspringen |
|
||||
@@ -423,12 +518,16 @@ curl https://macmini:8002/api/compliance/v1/canonical/generate/jobs \
|
||||
| Collection | Inhalte | Erwartete Regel |
|
||||
|-----------|---------|----------------|
|
||||
| `bp_compliance_gesetze` | Deutsche Gesetze (BDSG, TTDSG, TKG etc.) | Rule 1 |
|
||||
| `bp_compliance_recht` | EU-Verordnungen (DSGVO, NIS2, AI Act etc.) | Rule 1 |
|
||||
| `bp_compliance_datenschutz` | Datenschutz-Leitlinien | Rule 1/2 |
|
||||
| `bp_compliance_datenschutz` | Datenschutz-Leitlinien + EU-Verordnungen | Rule 1/2 |
|
||||
| `bp_compliance_ce` | CE/Sicherheitsstandards | Rule 1/2/3 |
|
||||
| `bp_dsfa_corpus` | DSFA-Korpus | Rule 1/2 |
|
||||
| `bp_legal_templates` | Rechtsvorlagen | Rule 1 |
|
||||
|
||||
!!! warning "bp_compliance_recht entfernt (2026-03-16)"
|
||||
Die Collection `bp_compliance_recht` wurde geloescht, da sie mit `bp_compliance_datenschutz`
|
||||
ueberlappte (~20.000 Duplikat-Chunks). Alle relevanten EU-Verordnungen sind in den anderen
|
||||
Collections enthalten.
|
||||
|
||||
---
|
||||
|
||||
## Processed Chunks Tracking
|
||||
@@ -514,10 +613,10 @@ curl -s https://macmini:8002/api/compliance/v1/canonical/generate/processed-stat
|
||||
|
||||
| Metrik | Wert |
|
||||
|--------|------|
|
||||
| RAG-Chunks gesamt | ~183.000 |
|
||||
| Verarbeitete Chunks | ~183.000 (vollstaendig) |
|
||||
| Generierte Controls | **~2.120** |
|
||||
| Konversionsrate | ~1,2% (nur sicherheitsrelevante Chunks erzeugen Controls) |
|
||||
| RAG-Chunks gesamt | ~105.000 (nach Dedup 2026-03-16) |
|
||||
| Verarbeitete Chunks | ~105.000 |
|
||||
| Generierte Controls | **~4.738** |
|
||||
| Konversionsrate | ~4,5% (nur sicherheitsrelevante Chunks erzeugen Controls) |
|
||||
|
||||
!!! info "Warum so wenige Controls?"
|
||||
Die meisten RAG-Chunks sind Definitionen, Begriffsbestimmungen, Inhaltsverzeichnisse oder
|
||||
|
||||
Reference in New Issue
Block a user