File upload testing checklist

Fourteen checks in the order the bytes travel: what the client claims, what the server decides, what the disk holds, what the next reader gets. The order matters because the first group settles which layer is supposed to decide a file's type, and every later check assumes that question has an answer. On the endpoints these procedures were written against, one 101,941-byte upload expanded to 104,857,600 bytes, a 196-byte PNG declared 900,000,000 pixels, and a payload named avatar.php.jpg passed an allowlist and came back with an image content type. None of those requests was malformed. Each check below names the layer it interrogates and the claim it refuses to take on trust.

14 checksabout 131 min end to end

What the request itself says

  • How to test multipart form data
    The boundary in the header and the delimiter in the body are not the same string, and a parser bug is unreadable until you have seen the raw bytes once.
    8 min
  • How to check if file type is validated on the server
    A file name, a part header and the bytes make three separate claims about type, and a 201 tells you the server believed one of the first two.
    8 min
  • How to check file type
    The signature is the only claim the client does not control, so this is the check the three that follow depend on.
    8 min

The name, which is attacker-supplied text

Size, before anything is decoded

What survived storage

What the next reader is handed

Take it with you

The file is the same list as Markdown checkboxes, ready to paste into a release ticket or a pull request description.

Ticks are kept in this browser only. They are not sent anywhere and other people do not see them.