Is it safe, in terms of security, to add localhost
to ATS NSExceptionDomains
for development use? It's not very convenient (and it's easy to forget) to remove those lines from Info.plist
file before every commit.
<dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>
Additionally, can Apple reject the application because of this?
App Transport Security (ATS) is an iOS feature that forces mobile apps to connect to back-end servers using HTTPS, instead of HTTP, to encrypt data in transit. ATS enforces a minimum security level for communications between a mobile app and web services that support its functionality.
On Apple platforms, a networking feature called App Transport Security (ATS) improves privacy and data integrity for all apps and app extensions. ATS requires that all HTTP connections made with the URL Loading System—typically using the URLSession class—use HTTPS.
You can now do this for local addresses:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsLocalNetworking</key> <true/> </dict>
Apple has blessed this key as an ATS exception — it has said it will not reject apps for using it. More info here: https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html (search in page for "local")
If it is not needed in the production version of the app, I would set up your build configs to use two different Info.plist files. You can basically have your internal version of the plist set up as "Internal-Info.plist" and have the localhost exclusion in it. Then have the production "Info.plist" which does not have that exclusion, giving Apple no reason to possibly reject your app now or in the future.
To configure your builds to automatically pull in the right Info.plist for the type of build:
Make sure you copy the "Info.plist" to a new file called "Internal-Info.plist", remove the exclusion from the "Info.plist" and you should be good.
Apple could reject you now for this (only Apple would know), but starting in 2017, Apple will be require a valid reason for any ATS exclusions, so unless you have a valid justification for excluding localhost ATS requirements, it's best to just set it up correctly now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With