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

This commit is contained in:
2026-10-31 04:06:38 +03:00
parent d812d8f8d8
commit de5efb4457
26 changed files with 1023 additions and 426 deletions
+4 -19
View File
@@ -1,5 +1,5 @@
# Собственные тесты API и разбора изображений
# дата: 2026-10-30T19:58Z, чистый clone
# Собственные тесты API и вложений
# дата: 2026-10-31T00:55Z, чистый clone
# стенд: Apple M3 Pro, 11 CPU, 18 GB RAM, macOS 26.1, Docker 29.3.0, Compose 5.1.0
$ make student-test
@@ -26,6 +26,7 @@ test_outsider_looks_the_same_as_missing (test_attachments.AccessTest.test_outsid
test_variants (test_attachments.AccessTest.test_variants) ... ok
test_broken_images (test_attachments.ContentCheckTest.test_broken_images) ... ok
test_extension_is_not_trusted (test_attachments.ContentCheckTest.test_extension_is_not_trusted) ... ok
test_files_from_review (test_attachments.ContentCheckTest.test_files_from_review) ... ok
test_mime_spoofing (test_attachments.ContentCheckTest.test_mime_spoofing) ... ok
test_unsupported_content_type (test_attachments.ContentCheckTest.test_unsupported_content_type) ... ok
test_bad_filenames (test_attachments.FilenameTest.test_bad_filenames) ... ok
@@ -94,22 +95,6 @@ test_parallel_repeat_through_different_replicas (test_idempotency.IdempotencyTes
test_repeat_checks_access_again (test_idempotency.IdempotencyTest.test_repeat_checks_access_again) ... ok
test_repeat_returns_same_message (test_idempotency.IdempotencyTest.test_repeat_returns_same_message) ... ok
test_same_key_for_other_user_and_other_chat (test_idempotency.IdempotencyTest.test_same_key_for_other_user_and_other_chat) ... ok
test_jpeg_without_frame_or_scan (test_images.BrokenImagesTest.test_jpeg_without_frame_or_scan) ... ok
test_not_images (test_images.BrokenImagesTest.test_not_images) ... ok
test_png_bad_crc (test_images.BrokenImagesTest.test_png_bad_crc) ... ok
test_png_data_after_end (test_images.BrokenImagesTest.test_png_data_after_end) ... ok
test_png_data_is_not_zlib (test_images.BrokenImagesTest.test_png_data_is_not_zlib) ... ok
test_png_with_wrong_amount_of_pixels (test_images.BrokenImagesTest.test_png_with_wrong_amount_of_pixels) ... ok
test_png_zero_size (test_images.BrokenImagesTest.test_png_zero_size) ... ok
test_random_corruption_never_crashes (test_images.BrokenImagesTest.test_random_corruption_never_crashes) ... ok
test_truncated (test_images.BrokenImagesTest.test_truncated) ... ok
test_jpeg_over_limit (test_images.PixelLimitTest.test_jpeg_over_limit) ... ok
test_limit_is_exact (test_images.PixelLimitTest.test_limit_is_exact) ... ok
test_png_bomb_is_rejected_before_unpacking (test_images.PixelLimitTest.test_png_bomb_is_rejected_before_unpacking) ... ok
test_course_fixture (test_images.RealImagesTest.test_course_fixture) ... ok
test_jpeg_with_data_after_end (test_images.RealImagesTest.test_jpeg_with_data_after_end) ... ok
test_marker_on_block_border (test_images.RealImagesTest.test_marker_on_block_border) ... ok
test_real_images_are_accepted (test_images.RealImagesTest.test_real_images_are_accepted) ... ok
test_chat_cursor_belongs_to_user (test_pagination.ChatPaginationTest.test_chat_cursor_belongs_to_user) ... ok
test_walk_chat_list (test_pagination.ChatPaginationTest.test_walk_chat_list) ... ok
test_bad_cursor (test_pagination.MessagePaginationTest.test_bad_cursor) ... ok
@@ -148,7 +133,7 @@ test_password_is_never_returned (test_validation.UserValidationTest.test_passwor
test_password_length_limits (test_validation.UserValidationTest.test_password_length_limits) ... ok
----------------------------------------------------------------------
Ran 142 tests in 7.240s
Ran 127 tests in 7.860s
OK