Files
mtusi2026lab5/evidence/attachments.txt
T

109 lines
5.3 KiB
Plaintext

# attachments
# date: 2026-11-11T23:52:28 commit: 276dbda
$ C:\Users\79152\AppData\Local\Python\pythoncore-3.14-64\python.exe student-tests/attachments.py --base-url http://localhost:8080
== позитивный сценарий ==
ok - upload PNG -> 202 (got 202)
ok - 202 queued, variants=[], error_code=null
ok - sha256/size describe the original
ok - no S3 key/bucket in public JSON
ok - upload JPEG with Unicode filename -> 202 (got 202)
ok - filename returned as is (display only)
ok - both become ready (worker)
ok - member downloads PNG -> 200 (got 200)
ok - downloaded bytes are identical (sha256)
ok - true Content-Type image/png
ok - nosniff header
ok - member downloads JPEG (variant=original) -> 200 (got 200)
ok - JPEG bytes and type
ok - message with empty text + 2 attachments -> 201 (got 201)
ok - attachment_ids kept in request order
ok - history shows attachment_ids
ok - text-only POST (lab3) still valid, attachment_ids=[]
ok - member reads metadata -> 200 (got 200)
ok - thumbnail variant exists in lab5 -> 200 (got 200)
ok - unknown variant name -> 400 (got 400)
== доступ ==
ok - outsider GET attachment metadata -> 404 (got 404)
ok - unknown attachment metadata -> 404 (got 404)
ok - outsider GET attachment/content -> 404 (got 404)
ok - unknown attachment/content -> 404 (got 404)
ok - anonymous download -> 401 (got 401)
ok - attachment id is not a UUID -> 400 (got 400)
ok - outsider uploads into foreign chat -> 404 (got 404)
ok - anonymous upload -> 401 (got 401)
== привязка к сообщению ==
ok - eve uploads into her own chat -> 202 (got 202)
ok - alice uploads into her second chat -> 202 (got 202)
ok - foreign attachment_id (eve's chat) in message -> 404 (got 404)
ok - attachment of ANOTHER chat of the same user -> 404 (got 404)
ok - unknown attachment_id -> 404 (got 404)
ok - one valid + one foreign -> whole message rejected -> 404 (got 404)
ok - duplicate attachment_ids -> 400 (got 400)
ok - same UUID in different case is a duplicate -> 400 (got 400)
ok - more than 10 attachment_ids -> 400 (got 400)
ok - attachment_id is not a UUID -> 400 (got 400)
ok - attachment_ids: null -> 400 (got 400)
ok - blank text without attachments -> 400 (got 400)
ok - text field is required -> 400 (got 400)
ok - any member may reference a chat attachment again -> 201 (got 201)
ok - eve attaches alice's file to her own chat -> 404 (got 404)
== идемпотентность с вложениями ==
ok - missing attachment_ids == [] (same Message)
ok - same key, different attachment_ids -> 409 (got 409)
ok - replay with attachments returns the same Message
== размер ==
ok - Content-Length = 10 MiB + 1, body never sent (limit before reading) -> 413 (got 413)
ok - Content-Length = 500 MiB -> 413 (got 413)
ok - chunked body > 10 MiB without Content-Length (stream cut at limit) -> 413 (got 413)
ok - real PNG of 11424004 bytes -> 413 (got 413)
ok - empty body -> 400 (got 400)
== пиксели ==
ok - decompression bomb 8000x8000 in 62290 bytes -> 413 (got 413)
ok - 40 040 001 pixels (just over the limit) -> 413 (got 413)
== повреждённые файлы ==
ok - truncated PNG -> 415 (got 415)
ok - truncated PNG: error code
ok - PNG with flipped byte (CRC) -> 415 (got 415)
ok - PNG with flipped byte (CRC): error code
ok - PNG signature only -> 415 (got 415)
ok - PNG signature only: error code
ok - PNG header + garbage -> 415 (got 415)
ok - PNG header + garbage: error code
ok - truncated JPEG -> 415 (got 415)
ok - truncated JPEG: error code
ok - JPEG SOI + garbage -> 415 (got 415)
ok - JPEG SOI + garbage: error code
== fuzz: случайные порчи байтов (только 202 или 415, никогда 500) ==
ok - 30 corrupted files -> only 202/415 (got [202, 415])
== подмена MIME ==
ok - PNG bytes sent as image/jpeg -> 415 (got 415)
ok - JPEG bytes sent as image/png -> 415 (got 415)
ok - text renamed to .png -> 415 (got 415)
ok - GIF sent as image/png -> 415 (got 415)
ok - HTML sent as image/jpeg -> 415 (got 415)
ok - PNG with Content-Type image/gif -> 415 (got 415)
ok - PNG with Content-Type application/octet-stream -> 415 (got 415)
ok - PNG with Content-Type text/html -> 415 (got 415)
== опасные filename ==
ok - filename '../../etc/passwd' -> 400 (got 400)
ok - filename 'dir/a.png' -> 400 (got 400)
ok - filename 'C:\\Windows\\a.png' -> 400 (got 400)
ok - filename 'a\x00.png' -> 400 (got 400)
ok - filename 'a\nb.png' -> 400 (got 400)
ok - filename 'tab\t.png' -> 400 (got 400)
ok - filename '\x1b[31mred.png' -> 400 (got 400)
ok - filename 'photo\u202egnp.exe' -> 400 (got 400)
ok - filename '..' -> 400 (got 400)
ok - filename '.' -> 400 (got 400)
ok - filename ' ' -> 400 (got 400)
ok - filename 'xxxxxxxxxxxxxxxxxxxx' -> 400 (got 400)
ok - filename missing -> 400 (got 400)
ok - filename of exactly 255 chars -> 202 (got 202)
ok - filename with spaces, Unicode and punctuation -> 202 (got 202)
ok - media type parameters are ignored -> 202 (got 202)
ok - no 500 and no dropped connection among 99 checked responses
91 passed, 0 failed
[exit 0]