Skip to content

[Bug]: Avatar upload accepts any file type/size with no client- or server-side validation #641

Description

@Priyanka0205-CSE

Bug Description

Description

The profile picture upload flow in ProfilePictureUpload.jsx sends whatever file the user selects straight to Firebase Storage. There is no check on MIME type, file extension, or file size before or during the upload, and no corresponding validation in Storage security rules.

Steps to Reproduce

  1. Go to Profile → Edit → Change avatar
  2. Select an arbitrary file (e.g. a .zip, .exe, or a 200MB image)
  3. Upload completes successfully and the file is stored

Expected Behavior

  • Only image MIME types (image/png, image/jpeg, image/webp) are accepted
  • A reasonable max file size is enforced (e.g. 5MB)
  • Rejected files show a clear inline error instead of silently uploading

Actual Behavior

Any file type and size is accepted and stored, with no feedback to the user if something goes wrong downstream (e.g. broken avatar rendering).

Impact

  • Storage abuse / cost inflation from oversized or unnecessary file uploads
  • Potential vector for hosting arbitrary (non-image) files under the app's storage bucket
  • Broken UI when non-image files are rendered as <img> avatars

Suggested Fix

Add client-side MIME/size validation before upload starts, and mirror the same constraints in Firebase Storage security rules so the check can't be bypassed by calling the API directly.

Metadata

Metadata

Labels

NSoC'26NSoC 2026backendBackend/Firebase related changesbugSomething isn't workingenhancementNew feature or requestfrontendFrontend related changes (HTML/CSS/JS/React)needs-reviewIssue needs reviewneeds-triagensocNSoC

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions