Record byte limits and allowed content
OWASP recommends multiple upload checks; an extension or declared Content-Type alone is insufficient. This sample local contract accepts PDF up to 2,000,000 bytes and requires a content check. That number is not a limit from any provider.
| File | Observed | Decision |
|---|---|---|
| A.pdf | 1,500,000 bytes; verified PDF content | Eligible for remaining security checks |
| B.pdf | 2,100,000 bytes | Reject under sample size limit |
| C.pdf | Declared PDF; actual unsupported content | Reject type mismatch |
Keep scan and transfer state distinct
Record file identity, size, verified type and scan disposition. A hash can detect accidental content change but does not prove a file is safe. Avoid retrying an oversized or disallowed attachment; offer the documented correction path.
A renamed executable has .pdf and application/pdf. Is it eligible because both labels match?
Show the worked answer
No. Check actual content and the security policy. Matching self-declared labels cannot replace server-side validation and scanning.