A developer is informed that their iOS app stores user passwords in NSUserDefaults. What is the security problem with this approach and what is the correct alternative?
- A.A. NSUserDefaults stores data in an unencrypted plist file in the app's container that can be easily read on a jailbroken device or accessed through iTunes/iCloud backup without encryption; passwords should be stored in the iOS Keychain, which encrypts data and ties access to device authentication state
- B.B. NSUserDefaults is deprecated in iOS 14+ and causes app rejection during App Store review
- C.C. NSUserDefaults data is accessible to other apps if they know the key name, violating app sandbox isolation
- D.D. NSUserDefaults is automatically cleared when the app is force-closed, making password storage unreliable
Why A is correct