Removed "OurFileProvider"#95
Conversation
|
-------------Outdated------------ Somehow along the way I ditched using it without removing.it is now merely a placeholder to contain the class name.I'll check the individual commits when I am back on a pc. |
|
A. per. the comments above, the fileprovider actually provides a file obfuscation problem. What really needs to be changed might be editing out the uneeded functions and renaming the fucntion to a more useful name. |
|
Now I see what the intention of the FileProvider was, but I still think that it is a very big solution for a very small problem. I don't know if the temp file really has to be hidden from the user. Further this leads to problems with some apps. e.g. I can open a video from Secrecy with the default Android video player. But if I use VLC as my default video player, I can't open a video. This is no problem without the FileProvider. If a user really cares where the temp files are, it would be no problem to find out where they are, with or without the FileProvider. Also deletion of the temp files also works without the FileProvider, so I'm not really sure what advantages that brings.. |
This seems to be a relict which isn't really needed anymore.
ef8955f to
fe70531
Compare
|
Is there a good way to handle purging of the temp file after being read by the opening app? The very basic reason why a fileprovider is used is that it can provide a ParcelFileDescriptor, which acts more or like a file location pointer. We can have better control over the file when the other app is opening it. The problem (I think) using the very simple system file provider is that you can never know whether the app has opened the file or not, and react according to the actions. Some apps are quite messy in their implementation of file I/O, with repeated file open/close and non-specific pattern where we are sure the app has already read all of data it needed, and it can be messy in the sense of security implementation. In the current implementation, when the file is opened, Note line 327 and 328 is custom implementation:
But if there is a better way of doing this with fileprovider and ensuring some time where we can purge the file I think I am fine with it. Ref1: on the behaviour of ParcelFileDescriptors Ref2: on a similar problem, which might be a pointer to a better implementation but I am still puzzling over this. |
|
I understood that reason and I have tested it, but the ParcelFileDescriptor seems to be broken in the master, because the files were not deleted as long as secrecy was running. There deleted when I left secrecy by the Storage.deleteTemp() method. I'll give it another try, but I thing that was the behavior back when I tested that. |
|
The behavior is quite fluctuant I guess. It is not really the best security implementation I could think of. |
|
Maybe we can improve the behavior. The Linux kernel provides the inotify methods to watch files for changes. It has been implemented into the FileObserver in Android http://developer.android.com/reference/android/os/FileObserver.html. Maybe we can use them for an improved file deletion. Edit: I see you are also using the FileObserver. I'll check that code. |
|
Yes. I have tried one implementation here: I have experimented it with a number of ways, coming to the following conclusions:
These are the biggest obstacles. If only we can get over them. |
|
Its pretty challenging to adapt to other bad implementations.. We always clean the cache directory when secrecy is properly closed. So we always have that as a fall back. And maybe that is already enough security if other apps are really using files that bad. |
This seems to be a relict which isn't really needed anymore.
@Doplgangr maybe
OurFileProviderdid something else that I missed, but it seems to me that the changedFileViewershould do the same as before.