Skip to content

feat(upload): strip EXIF metadata from uploaded images - #1735

Open
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-1657
Open

feat(upload): strip EXIF metadata from uploaded images#1735
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-1657

Conversation

@singhanurag0317-bit

Copy link
Copy Markdown

Feature: Automatic EXIF Metadata Stripping for Uploaded Images

Closes #1657

Problem

Uploaded user photos could retain sensitive EXIF metadata (GPS coordinates, camera serial numbers, timestamps), violating user privacy.

Change

  • New stripImageExifData(filePath) in backend/src/middleware/upload.middleware.js:
    • Re-encodes the image through a sharp pipeline (.rotate() bakes EXIF orientation into pixels, then output is written without metadata), removing all EXIF/GPS/camera data while keeping the image visually identical.
    • Reads via buffer to avoid platform file-handle quirks.
  • validateImageChain now runs stripImageExifData as a step in the upload validation pipeline, so every single-file upload is scrubbed of EXIF prior to storage/processing. On failure the file is cleaned up and a 400 is returned.

Tests

New backend/src/middleware/__tests__/stripExif.test.js:

  • JPEG created with withMetadata({ orientation: 6 }) has EXIF + orientation removed after stripping.
  • Stripped JPEG stays valid, same orientation-baked dimensions (300x400), still jpeg.
  • PNG files are stripped too.

Full backend suite: 9 suites / 23 tests passing.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@singhanurag0317-bit is attempting to deploy a commit to the souma9830's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Automatic EXIF Metadata Stripping for Uploaded Images

1 participant