cordova-plugin-file
cordova-plugin-file copied to clipboard
"writeToFile:atomically: true" may cause security breach
Feature Request
Motivation Behind Feature
HongKong country application audit team has complained about it ? An attacker may access the temporary files and replace them with another just before the file is moved to actual directory. This may allow the attacker to control the content of files used by the application.
Feature Description
Can we use file descriptors instead of file path. Initialize an NSFIleHandle object with the file descriptor and use NSFileHandle methods to write to the file.
Don't see any drawbacks in existing but new feature can provide more security? Don''t see any breaking changes on this?
Alternatives or Workarounds
We are looking for change to get it updated from your team on this
Not really an expert in this repo but I believe the main reason file paths are used is largely due to some cross-app communication, such as from the camera plugin using the camera app.
But wouldn't file descriptors have the same problem? In theory I would think a file could have its contents replaced and the file descriptor when used to read the file will end up reading the new contents. I think this is a general problem with any file that is in a public location, the only way to really trust the contents is if you have an expected checksum that you can use to test the file contents against.
Closing due to lack of response.