Strip EXIF metadata from uploaded images #23
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/server#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Photos from phones (iOS Photos, Android camera) routinely carry EXIF
metadata: GPS coordinates, camera serial, capture timestamp. The current
`POST /api/v1/uploads` pipeline (#22) writes bytes verbatim — meaning
sending an image leaks the user's location to every recipient.
This is a day-one privacy regression for the image-send flow as soon as
clients start using it.
Scope
Add an EXIF-stripping pass to `internal/api/upload.go` after the
imagesniff cross-check and before `uploads.Write`. JPEG and PNG both
have well-known metadata segments:
SOI, SOFn, DQT, DHT, DAC, DRI, SOS, image data, EOI.
(IHDR, IDAT, IEND, PLTE, tRNS, gAMA, sRGB, cHRM, iCCP for color
correctness). Strip tEXt, zTXt, iTXt, eXIf, tIME, pHYs as a baseline.
A small dependency-free Go implementation is preferable (the bytes are
already in memory at that point — no need to round-trip through
`image.Decode` which would also re-encode).
Out of scope
Acceptance
the bitmap data.
Related: #22 (the upload endpoint that introduced this gap).