Document upload security
Document uploads are usually where teams need a softer decision than “block everything suspicious” while still keeping risky files out of durable storage.
Common risks
Section titled “Common risks”- Macro-enabled Office files.
- PDFs with active or suspicious actions.
- Executables renamed as documents.
- ZIP-wrapped document bundles.
Recommended baseline
Section titled “Recommended baseline”- Use a document-specific allowlist instead of a generic upload route.
- Start with
DOCUMENTS_ONLYorSTRICT_PUBLIC_UPLOAD. - Pair document routes with
CommonHeuristicsScanner. - Quarantine
suspiciousdocuments if business users still need review.
Example
Section titled “Example”import { scanBytes, DOCUMENTS_ONLY } from 'pompelmi';
const report = await scanBytes(bytes, { filename, mimeType, policy: DOCUMENTS_ONLY, failClosed: true,});