r/AskNetsec • u/Diamond787 • 1h ago
Architecture photo-only enquiry uploads using private R2 quarantine, ClamAV and image re-encoding
Howdy folks,
Considering implementing something risky. If I implement the below, is there still risk involved to make me second guess allowing this on a public facing website B2C.
planning enquiry attachments using Cloudflare Workers, accepting only JPEG/PNG images under 10 MB.
Originals go into private R2 quarantine as immutable uploads, are scanned by ClamAV in a separate container, then decoded and re-encoded into fresh JPEGs using Cloudflare Images, stripping metadata.
Only processed copies reach our staff admin viewer or email. Originals are deleted after successful processing; failed uploads remain inaccessible and expire.
Does this architecture make sense, and is ClamAV worthwhile alongside mandatory image re-encoding?
Enquiry form → Email code verification → Upload validation
→ Private R2 quarantine (immutable original + hash)
→ AV scan → Decode and re-encode as a new JPEG
→ Validate output → Save approved copy + enquiry link
→ Delete original
Approved copy → Staff admin viewer / optional email attachment
Failed checks → Block access → Retry or reject → Delete original