-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Image EXIF/XMP metadata removal routine #2863
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
Conversation
…locationAccuracy)
…upport Set<String> data type used in preferences (EXIF tags)
…oordinates in FileProcessor, GPSExtractor
Codecov Report
@@ Coverage Diff @@
## master #2863 +/- ##
=========================================
+ Coverage 3.69% 3.69% +<.01%
=========================================
Files 247 249 +2
Lines 12217 12268 +51
Branches 1083 1088 +5
=========================================
+ Hits 451 453 +2
- Misses 11732 11780 +48
- Partials 34 35 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a clean PR
I aprroved it by reading the code, however it needs some tests. Does anyone have some tests photos which has location EXIF? |
I should have some but can't write the tests. I can post them here though.
…On Apr 10, 2019 1:45 PM, "neslihanturan" ***@***.***> wrote:
I aprroved it by reading the code, however it needs some tests. Does
anyone have some tests photos which has location EXIF?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2863 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHRLoyJ-cgLD6AsChhd_vihN_oPGlmCYks5vfcC2gaJpZM4cepyC>
.
|
Hello @VitalyVPinchuk , thanks for taking over this PR. It seems that the location accuracy feature has been carried over - unfortunately this is very contentious, as per the comments starting #1712 (comment) . Until we can reach a consensus on how to do this without adding erroneous information to Commons, I would strongly suggest removing that part from the PR entirely, and keeping the rest of the anonymization. Then we can go ahead with merging this PR if the tests succeed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending removal of feature that submits deliberately imprecise coordinates
Hello @misaochan Should I manage lat/long tags as the rest of the other exif tags? That is, just provide a user an option to keep them or remove them? |
Yes, this sounds good, thanks! :) |
Updated. |
Hi @VitalyVPinchuk I have tested for camera model and it works. @ilgazer it would be nice using your test images if they include geotag etc. @misaochan which aspects of this PR did you test? |
@neslihanturan I have not tested this, sorry. I have only looked at the code to check that the location accuracy feature was removed. :) |
@VitalyVPinchuk Can you rename the PR title to make it more descriptive. |
@VitalyVPinchuk Can you also add unit test cases for the changes made in this PR. |
app/src/main/java/fr/free/nrw/commons/kvstore/BasicKvStore.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/kvstore/KeyValueStore.java
Outdated
Show resolved
Hide resolved
|
||
import static androidx.exifinterface.media.ExifInterface.*; | ||
|
||
public class FileMetadataUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add unit test cases.
app/src/main/java/fr/free/nrw/commons/upload/FileMetadataUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/FileMetadataUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/FileMetadataUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/FileProcessor.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/FileProcessor.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/FileProcessor.java
Outdated
Show resolved
Hide resolved
Thanks for the thorough analysis, I'll try to fix all of your remarks. |
THese are my test images, I hope they are useful to you as well: By the way, the XMP code vas very much a work in progress and wasn't working if I remember correctly. Has anyone tested it? Looking back, starting work on XMP support feels like scope creep. Maybe we should add in the EXIF stuff and put the XMP stuff in a seperate PR? |
… JsonKVStore already has it.
…IF redaction fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all reviewers should be happy by now. Thanks for the great job both @VitalyVPinchuk and @ilgazer .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, I thought this PR is ready to be merged but Travis fails...
I can't understand what causes the issue. Can it be due to adding a folder with sample image? |
val filePathTmp: String? = "" + System.getProperty("java.io.tmpdir") + "exif_redact_sample_tmp.jpg" | ||
|
||
val inStream = FileInputStream(filePathRef) | ||
val outStream = FileOutputStream(filePathTmp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the details of the test results, it says:
fr.free.nrw.commons.upload.FileProcessorTest > redactExifTags FAILED
java.io.FileNotFoundException at FileProcessorTest.kt:53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I removed it. Help needed. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @VitalyVPinchuk , let me investigate. Thanks for your fast responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @neslihanturan
Any luck investigating the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VitalyVPinchuk sorry for the delay. Currently I have another task, I am planning to finalize this one at May 18. Thanks for keeping the pr up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VitalyVPinchuk , I am still busy with my current refactor task. Didn't forget about this one though:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this issue is sent before our test requirement and there is so much effort on this thread, we decided to merge this. Thanks @VitalyVPinchuk , I will create an issue to add tests for this PR.
Hi @VitalyVPinchuk Sorry to bother you after the PR is closed, but this merge has introduced a new bug which prunes out GPS information from the Exif data.
Line Number 125, FileProcessor.Java, current master. I could not exactly understand the utility of this function. Can you explain me what exactly is the purpose of this function? |
Hello @ashishkumar468 ! |
Thanks for quick response @VitalyVPinchuk . Does it mean that the attributes which are unticked in Privacy->Manage Exif Tags will not be sent/used ? |
Yes it does. Though it doesn't seem for me really straightforward but the community wants it this way. I figured that out from the discussion thread of the initial author of PR that I used. |
IMO, It should have been like by default all the attributes should have been checked, and pruned only when the user explicitly unchecks it. It is very unlikely that the user would go and enable these attributes from the settings on their own and as a result of which we are not using certain exif attributes which we actually need to (for example the GPS coordinated for showing categories), even though the user has not himself actually asked for it? |
I apologize for not reading the code thoroughly before this was merged. I was assuming that the user would be given the option of stripping their EXIF information (as per the wording of #70 ), not that it would be stripped by default. FTR, even the web-based Upload Wizard (the default uploader) does not silently strip EXIF, although it allows users the option of removing some of them (i.e. location) during the upload. Check https://commons.wikimedia.org/wiki/File:Sprungli_Confiserie.jpg for instance, which I just uploaded using the default uploader. I personally feel like silently stripping EXIF by default would be a bad move for us. Users will not be aware of it and will believe that the app is malfunctioning. In order to release with this feature, I think we should at the very least make the default option work the same way as the app always has - with the tags present. A beneficial addition would be to have a separate upload field that shows the user which EXIF tags are being taken from the image, with a link to the Settings to disable them - but this will likely be a future enhancement. @neslihanturan @maskaravivek @nicolas-raoul @VojtechDostal thoughts are most welcome. |
I am okay with the either way, but in either options we should emphasize user can change settings "now" and link them to settings page. Otherwise this feature may be forgotten or unrecognized even by privacy concerned people. |
Can we do this in time for this release? Otherwise we may have to revert and bump this feature for the next release. I personally think releasing without the emphasis is fine, we can always add the emphasis in the next release. It is still an improvement and would not require a revert. |
Sure, not necessary for this release considering we have short time. |
So setting all the attributes checked by default seems to a be a good decision. |
Thank you @VitalyVPinchuk . :) That's my thoughts on it, yes, but let's give @nicolas-raoul a bit of time to weigh in since he wrote the original issue. |
Yes it should be off by default. Thanks! |
@nicolas-raoul Just to clarify, you mean the EXIF removal should be off by default, right? |
@maskaravivek Yes exactly. |
Description (required)
Updating pull request #1712 to recent app version.
Fixes #1712 [WIP] Implements of in-app EXIF and location anonymization
In response to #2671.
What changes did you make and why?
Uses @ilgazer's code of branch master.
Method redactExifTags() is called from FileProcessor.processFileCoordinates(), which removes selected EXIF tags from file being uploaded.
Tests performed (required)
Tested betaDebug on emulator with API level 28.
Instrumental tests are broken for me now.
Screenshots showing what changed (optional - for UI changes)