feat(B-STOR): Gemeinsamer File Storage — MIME-Prüfung, Size-Limits, Hashing, save_with_metadata

B-STOR: storage.py um 5 Funktionen erweitert
- validate_mime(): MIME-Erkennung (python-magic/mimetypes) + Allowlist-Prüfung
- validate_size(): Dateigrößen-Prüfung (Default 50MB, konfigurierbar)
- compute_hash(): SHA256/MD5/SHA1 Hash-Berechnung
- save_with_metadata(): save + validate + hash in einem Call
- get_file_metadata(): File-Stat ohne Content zu laden
- config.py: storage_max_file_size_mb, storage_allowed_mimes Settings
- Backward compatible: save/read/delete/exists unverändert

B-STOR-TEST: 27 Tests in test_storage.py — alle grün
- Path-Traversal, MIME-Validation, Size-Limits, Hashing, save_with_metadata, LocalStorage, Factory

B-STOR-MIG: Bereits erledigt — DMS, Mail, Report-Generator, Attachments nutzen bereits get_storage_backend()
This commit is contained in:
Agent Zero
2026-08-13 16:32:24 +02:00
parent 211242a807
commit a3a26d1f66
3 changed files with 525 additions and 0 deletions
+2
View File
@@ -48,6 +48,8 @@ class Settings(BaseSettings):
# Storage
storage_path: str = "/data/storage"
storage_max_file_size_mb: int = 50
storage_allowed_mimes: str = "" # comma-separated, empty = all allowed
# SMTP
smtp_host: str = "localhost"