Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip media metadata. #2907

Closed

Conversation

NSDestr0yer
Copy link

@NSDestr0yer NSDestr0yer commented Jan 3, 2018

  • removes non-orientation metadata from image and video attachments
  • option to disable the feature

Description

Strips non-orientation metadata from image and video attachments, with an option to leave the metadata in. This was tested by printing out the metadata dictionaries before and after the modification, as well as checking the attachment on a secondary device to make sure the information was truly removed.

All attachments flow through the SignalAttachment class. Images flow through the imageAttachment method of that class which strips out the metadata. I noticed that the master branch has been updated so that all video attachments are piped through the compressVideoAsMp4 inside the SignalAttachment class, so removal of video metadata was implemented there.

Fixes #1984

kCGImagePropertyJFIFDictionary as String : kCFNull,
kCGImagePropertyPNGDictionary as String : kCFNull,
kCGImagePropertyIPTCDictionary as String : kCFNull,
kCGImagePropertyMakerAppleDictionary as String : kCFNull
Copy link
Contributor

@charlesmchen charlesmchen Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things to test

  • Orientation is preserved.
  • GIF timing is preserved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Color profiles are preservd.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I just re-tested that the color space and profile, as well as orientation is preserved.

After stripping the data, these fields are left, for example:

([{TIFF}: {
Orientation = 1;
ResolutionUnit = 2;
XResolution = 72;
YResolution = 72;
}, PixelWidth: 3264, {Exif}: {
ColorSpace = 1;
PixelXDimension = 3264;
PixelYDimension = 2448;
}, PixelHeight: 2448, {JFIF}: {
DensityUnit = 0;
JFIFVersion =     (
    1,
    0,
    1
);
XDensity = 72;
YDensity = 72;
}, ProfileName: sRGB IEC61966-2.1, DPIWidth: 72, DPIHeight: 72, ColorModel: RGB, Orientation: 1, Depth: 8])

Timing looks good even with the iOS 11 live photo "GIF" movies that can be sent.

@michaelkirk
Copy link
Contributor

Hey @collinstuart - we had a rather large release backlogged, but now that it's out, we'd like to test this and get it merged. Can you rebase?

@NSDestr0yer
Copy link
Author

@michaelkirk - sure, I should be able to get to that today!

- removes non-orientation metadata from image and video attachments

- option to disable the feature

// FREEBIE
@NSDestr0yer
Copy link
Author

@michaelkirk done :)

@michaelkirk-signal
Copy link
Contributor

In d9b8ce2. Thanks!

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

Successfully merging this pull request may close these issues.

SECURITY ISSUE: Signal doesn't strip EXIF from sent images, including precise location data
5 participants