Проверять содержимое изображений: байты фильтра PNG и настоящее декодирование JPEG

This commit is contained in:
2026-10-31 04:06:58 +03:00
parent d812d8f8d8
commit d34d0bec79
26 changed files with 1024 additions and 427 deletions
+6 -1
View File
@@ -6,7 +6,7 @@ COMPOSE = docker compose --env-file .env
COMPOSE_TEST = $(COMPOSE) -f compose.yaml -f compose.test.yaml
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
.PHONY: help check validate test load test-persistence test-failover env up down clean restore student-test test-failures explain failover-each failover-hard rolling-update janitor upload-peak attachment-demo
.PHONY: help check validate test load test-persistence test-failover env up down clean restore student-test test-failures explain failover-each failover-hard rolling-update janitor upload-peak attachment-demo test-images
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@@ -84,3 +84,8 @@ upload-peak:
# сценарий защиты: файл, сообщение, второй участник, посторонний, прямой GET в S3
attachment-demo:
$(PYTHON) scripts/attachment_demo.py
# разбор изображений и сверка с Pillow внутри образа API: там установлен декодер
test-images:
COPYFILE_DISABLE=1 tar -cf - src/images.py student-tests/samples.py student-tests/image tests/fixtures/sample.png | \
docker run --rm -i --entrypoint sh mtusi-messenger:lab4 -c 'cd /tmp && tar -xf - && python -m unittest discover -s student-tests/image -v'