Skip to content

[BE-91] File upload validation and malware scanning (clamscan is installed but unused) #1445

Description

@yusuftomilola

Overview

clamscan is in backend/package.json dependencies but imported nowhere (grep -rl clamscan backend/src → 0 files). Uploads flow through multer/cloudinary with no verified size, type, or content checks. Either wire it up or drop the dependency.

Tasks

  • Add a reusable upload validation pipe: max size per type, MIME allowlist, and magic-byte sniffing (do not trust the client-supplied Content-Type or file extension).
  • Wire clamscan into the upload path — reject infected files with 422 and log the detection; make the scanner optional via env flag so local dev without a ClamAV daemon still works.
  • Strip EXIF metadata from images with the already-installed sharp (removes GPS location from member photos).
  • Enforce limits centrally so every upload route inherits them.
  • If maintainers prefer not to run ClamAV, remove clamscan from dependencies instead.

Acceptance Criteria

  • Uploading a .exe renamed to .jpg is rejected by magic-byte checking.
  • Oversized uploads are rejected before hitting Cloudinary.
  • EXIF GPS data is absent from stored images.
  • clamscan is either used or removed — no dead dependency remains.

Notes for Contributors

Comment below to be assigned.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions