BotNetwork

Virus scanning uploads in bots

Size caps first; async scan before processing.

Guide1 min readUpdated

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

  1. Allowlist extensions and MIME types; verify content matches.
  2. Scan in a worker with no chat token access.
  3. Quarantine failures; never auto-open archives in the bot host.
  4. Size-cap before scanning to protect the scanner.
  5. 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.

Related comparisons and tools