Why it matters
User uploads can carry malware — scan before storage or fan-out, cap types/sizes and process in an isolated worker.
Practical steps
- Allowlist extensions and MIME types; verify content matches.
- Scan in a worker with no chat token access.
- Quarantine failures; never auto-open archives in the bot host.
- Size-cap before scanning to protect the scanner.
- Log scan verdicts with correlation ids, not file contents.
Watch out for
- Trusting client-provided Content-Type alone.
- Scanning synchronously on the webhook ACK path.