feat: implement comprehensive file upload security

- Add comprehensive file validation with magic bytes, MIME type, and PIL checks
- Implement malicious content detection and polyglot attack prevention
- Add EXIF data sanitization to prevent metadata leaks
- Enhance UploadPhotoForm with security validation
- Add security logging for audit trails
- Include comprehensive test suite for security features
- Add python-magic dependency for MIME type detection
- Update configuration with security settings
- Add detailed documentation for file upload security

Security features:
- File type validation (magic bytes + MIME type)
- Content security scanning (malware detection)
- EXIF data sanitization (privacy protection)
- Enhanced logging (security event tracking)
- Comprehensive test coverage

Removed rate limiting as requested for better user experience.
This commit is contained in:
Oliver Falk
2025-10-15 15:30:32 +02:00
parent 368aa5bf27
commit d37ae1456c
11 changed files with 897 additions and 4 deletions

3
config_local_test.py Normal file
View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# Test configuration to verify LOGS_DIR override
LOGS_DIR = "/tmp/ivatar_test_logs"