Spaces:
Running
Running
Commit History
-
Add architecture hardening: rate limiting, caching, and CI/CD (#14)
Security & Performance: - Rate limiting via slowapi (10 req/min on analyze, 30 on root) - Double file validation (content-type header + python-magic MIME) - Explicit 10MB size limit on analysis endpoint - Reject non-image content before expensive processing - Log rejected requests with IP for monitoring Caching: - In-memory SHA-256 keyed forensics cache - TTL: 60 minutes per entry - Max 500 entries (LRU eviction) - Same file uploaded twice returns cached result instantly - Cache hit metadata included in response - Privacy: stores results only, never file bytes CI/CD (GitHub Actions): - Runs on every push and PR to main - Python 3.11 on Ubuntu latest - pip caching for faster runs - libmagic system dependency installed - pytest with coverage reporting - Blocks merge if tests fail Tests: 31 tests covering cache, rate limiting, validation Closes #142932db8