- tests/test_security.py: 30 security regression tests covering secure headers, CSP directives, middleware ordering, DRF throttle configuration, and SecurityAuditMiddleware event-detection logic - tests/test_upload.py: 19 upload defense tests covering extension allow-list, byte-length limits, and magic-byte signature validation (polyglot / disguised executable detection) - pytest.ini: register 'security' and 'upload' markers (--strict-markers enforcement was already on) Security settings already committed in feat(TRA-233) via harness include: SECURE_REFERRER_POLICY, CSP_* directives, DEFAULT_THROTTLE_*, MAX_UPLOAD_SIZE, SESSION/CSRF cookie hardening, AWS presigned URL policy, and SecurityAuditMiddleware with dual-logger (access + security) pattern. Co-Authored-By: Paperclip <noreply@paperclip.ing>
15 lines
520 B
INI
15 lines
520 B
INI
[pytest]
|
|
DJANGO_SETTINGS_MODULE = config.settings.test
|
|
python_files = tests/test_*.py **/tests/test_*.py
|
|
python_classes = Test*
|
|
python_functions = test_*
|
|
addopts =
|
|
--reuse-db
|
|
--strict-markers
|
|
markers =
|
|
smoke: smoke tests that verify startup and critical wiring
|
|
settings: settings-matrix tests
|
|
integration: tests requiring live service connections
|
|
security: security regression tests (headers, CSP, throttling, middleware)
|
|
upload: upload defense tests (extension, size, magic-byte validation)
|