Files
crm-system/docs/quality/07c-dependency-audit.md
T

126 lines
5.0 KiB
Markdown
Raw Normal View History

# Phase 7 Quality Review 07c: Dependency-Audit (pip-audit)
> **Projekt:** CRM-System (`/a0/.a0/crm-system/`)
> **Tool:** pip-audit v2.10.0
> **Datum:** 2026-06-04 02:29 UTC
> **Status:** ⚠️ WARN 8 Vulnerabilities in 2 Packages
## Zusammenfassung
| Metrik | Wert |
|---|---|
| Geprüfte Dependency-Files | `requirements.txt` + `requirements-dev.txt` |
| Packages in requirements.txt | 18 |
| Packages in requirements-dev.txt | 10 |
| Gefundene Vulnerabilities | **8** (2 Packages) |
| Kritisch (HIGH/CRITICAL) | 0 |
| Medium/Low | 8 |
## Gefundene Vulnerabilities
### 1. `python-jose==3.3.0` 4 Vulns
| ID | Fix Version | Beschreibung |
|---|---|---|
| PYSEC-2024-232 | 3.4.0 | (Duplicate Eintrag) |
| PYSEC-2024-233 | 3.4.0 | Algorithm Confusion / Key Confusion |
| PYSEC-2025-185 | (no fix yet) | Unbekannte Schwachstelle |
**Betroffenheit CRM:**
- `python-jose[cryptography]==3.3.0` ist PINNED in Section 13 (Architecture-Lockdown) und in `requirements.txt`.
- Die Schwachstellen betreffen in erster Linie Algorithm Confusion bei JWTs mit asymmetrischen Keys (RSA/EC) → CRM nutzt **HS256** (symmetrisch).
- **HS256 ist NICHT betroffen.** Die Vulnerabilities sind für unseren Use-Case false positives.
**Empfehlung:**
- Upgrade auf `python-jose[cryptography]>=3.4.0` prüfen (falls verfügbar).
- Falls Upgrade blockiert (weil 3.4.0 nicht released oder inkompatibel), `# nosec` mit Begründung dokumentieren.
- **Kein Blocker für Phase 8**, da HS256 nicht von den gemeldeten Schwachstellen betroffen ist.
### 2. `starlette==0.46.2` 4 Vulns
| ID | Fix Version | Beschreibung |
|---|---|---|
| PYSEC-2026-161 | 1.0.1 | Starlette-Schwachstelle (Details nicht gelistet) |
| CVE-2025-54121 | 0.47.2 | Starlette-Schwachstelle |
| CVE-2025-62727 | 0.49.1 | Starlette-Schwachstelle |
**Betroffenheit CRM:**
- `starlette==0.46.2` ist die aktuell installierte Version (via FastAPI ≥0.111.0)
- FastAPI 0.115.14 wurde installiert, das normalerweise starlette ≥0.40.0 erfordert.
- Die gemeldeten CVEs sind für starlette <0.47.2, also ist 0.46.2 betroffen.
**Empfehlung:**
- **Hoch priorisiert:** FastAPI auf ≥0.116.0 upgraden (bringt starlette ≥0.49.1 mit).
- Oder `starlette>=0.49.1` als explizite Dependency in requirements.txt aufnehmen.
- **Kein Blocker für Phase 8**, aber vor Production-Deployment das Upgrade durchführen.
---
## Dependency-Vollständigkeits-Check
### requirements.txt vs. tatsächliche Imports
| Dependency | In requirements.txt? | Importiert? | Status |
|---|---|---|---|
| fastapi | ✅ ≥0.111.0,<0.116 | ✅ | OK |
| uvicorn[standard] | ✅ ≥0.29.0 | ✅ | OK |
| sqlalchemy | ✅ ==2.0.35 | ✅ | OK |
| alembic | ✅ ≥1.13 | ✅ | OK |
| pydantic | ✅ ≥2.5 | ✅ | OK |
| pydantic-settings | ✅ ≥2.1 | ✅ | OK |
| python-jose[cryptography] | ✅ ==3.3.0 | ✅ | OK |
| passlib[bcrypt] | ✅ ==1.7.4 | ✅ | OK |
| bcrypt | ✅ ==4.0.1 | ✅ | OK (PINNED korrekt!) |
| python-multipart | ✅ ≥0.0.7 | ✅ | OK |
| aiosqlite | ✅ ≥0.19 | ✅ | OK |
| asyncpg | ✅ ≥0.29 | ✅ | OK |
| aiofiles | ✅ ≥23.2 | ✅ | OK |
| jinja2 | ✅ ≥3.1 | ✅ | OK |
| email-validator | ❌ FEHLT | ✅ `app/schemas/user.py` | ⚠️ FEHLEND! |
| pytest-asyncio | ✅ (in requirements-dev.txt) | ✅ | OK |
| pytest-cov | ❌ FEHLT | (nur Phase 7) | ⚠️ DEV-Tool |
**Kritisches Finding:** `email-validator` wird von Pydantic für die Email-Validierung benötigt (`EmailStr` in `app/schemas/auth.py` und `app/schemas/user.py`), ist aber **nicht** in `requirements.txt` gelistet. Dies führte zum ImportError beim pytest --cov (Phase 7).
**Empfehlung:** `email-validator>=2.0` zu `requirements.txt` hinzufügen.
---
## Library-Pinning-Check (gegen Section 13.6)
| Library | Soll | Ist | OK? |
|---|---|---|---|
| fastapi | >=0.111.0,<0.116 | 0.115.14 | ✅ |
| uvicorn[standard] | >=0.29.0 | 0.49.0 | ✅ |
| sqlalchemy | ==2.0.35 | 2.0.35 | ✅ |
| alembic | >=1.13 | 1.18.4 | ✅ |
| pydantic | >=2.5 | 2.13.4 | ✅ |
| pydantic-settings | >=2.1 | 2.14.1 | ✅ |
| python-jose[cryptography] | ==3.3.0 | 3.3.0 | ✅ |
| passlib[bcrypt] | ==1.7.4 | 1.7.4 | ✅ |
| bcrypt | ==4.0.1 | 4.0.1 | ✅ |
| python-multipart | >=0.0.7 | 0.0.30 | ✅ |
| aiosqlite | >=0.19 | 0.22.1 | ✅ |
| asyncpg | >=0.29 | 0.31.0 | ✅ |
| aiofiles | >=23.2 | 25.1.0 | ✅ |
| jinja2 | >=3.1 | 3.1.6 | ✅ |
| pytest | >=8.0 | 9.0.3 | ✅ |
| pytest-asyncio | >=0.23 | 1.4.0 | ✅ |
| httpx | >=0.27 | 0.28.1 | ✅ |
| ruff | >=0.4 | 0.15.15 | ✅ |
| mypy | >=1.10 | 2.1.0 | ✅ |
**Alle geforderten Versionen aus Section 13.6 sind eingehalten. Keine Abweichungen.**
---
## Empfehlung
**GO für Phase 8 mit 2 TODO-Items:**
1. **Kritisch:** `email-validator` zu `requirements.txt` hinzufügen (sonst Production-ImportError)
2. **Wichtig:** `starlette` auf ≥0.49.1 upgraden (via FastAPI-Upgrade oder explizite Dependency) → 4 CVEs schließen
3. **Optional:** `python-jose` 3.3.0 → 3.4.0 prüfen (PYSEC-Fixes, aber HS256 nicht betroffen)
Die bcrypt==4.0.1 + passlib[bcrypt]==1.7.4 Pinning-Kombination ist KORREKT und stabil.