01 / The problem
A real need.
A PDF extension does not make an upload trustworthy. Malformed structures, active content, resource exhaustion and scanner outages need explicit handling.
Defensive document analysis / Project notes
Quarantine first. Inspect uploaded PDFs in a separate worker and explain the findings.

01 / The problem
A PDF extension does not make an upload trustworthy. Malformed structures, active content, resource exhaustion and scanner outages need explicit handling.
02 / The approach
Authenticated uploads enter quarantine outside the webroot. A separate worker combines ClamAV, qpdf and pikepdf signals into a private, explainable report without executing the document.
03 / Engineering decisions
The API streams bounded uploads into quarantine and queues a PostgreSQL job. A non-root worker performs the expensive analysis outside the API process.
Scanner outages and timeouts produce ANALYSIS_FAILED, never SAFE. The verdict must preserve the uncertainty of the inspection.
Findings contribute to a documented risk score. Owner-scoped access and audit events keep the report tied to the authenticated upload workflow.
04 / Verification & scope
The repository documents tests using harmless synthetic PDFs and mocked scanner responses, plus frontend, backend and container checks. No malware is needed to exercise the failure semantics.
A SAFE result is not a guarantee that a file is harmless. Static inspection may miss unknown threats, encrypted content or obfuscation. Original documents are not served back for inline preview.
Bounded embedded-object scanning, stale-job recovery and secure cookie sessions are documented improvements.
Read the project documentation ↗