Rule Definition
Insecure data storage vulnerabilities occur when development teams assume that users or malware will not have access to a mobile device's filesystem and subsequent sensitive information in data-stores on the device.
If the program does not ensure that the user is only requesting private files, then the user might be able to access other files on the system.
Remediation
Instead of using FileProtectionType.none or URLFileProtection.none options, please use one of the following option:
FileProtection.complete
FileProtection.completeUnlessOpen
FileProtection.completeUntilFirstUserAuthentication
URLFileProtection.complete
URLFileProtection.completeUnlessOpen
URLFileProtection.completeUntilFirstUserAuthentication
Violation Code Sample
FileManager.default.createFile(atPath:PATH, contents:someData, attributes:[FileProtectionKey.protectionKey:FileProtection.none])
FileManager.default.createFile(atPath:PATH, contents:someData, attributes:[FileProtectionKey.protectionKey:URLFileProtection.none])
Fixed Code Sample
FileManager.default.createFile(atPath:PATH, contents:someData, attributes:[FileProtectionKey.protectionKey:FileProtection.complete])
FileManager.default.createFile(atPath:PATH, contents:someData, attributes:[FileProtectionKey.protectionKey:URLFileProtection.complete])
Reference
https://www.owasp.org/index.php/Mobile_Top_10_2016-M2-Insecure_Data_Storage
Related Technologies
Technical Criterion
Secure Coding - API Abuse
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.