Skip to content

Commit

Permalink
Fix NSAppTransportSecurity being overwritten during pod install (#41875)
Browse files Browse the repository at this point in the history
Summary:
This PR fixes #41874.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[iOS] [Fixed] - Fix NSAppTransportSecurity being overwritten during pod install

Pull Request resolved: #41875

Test Plan:
1. Delete the whole `NSAppTransportSecurity` in Info.plist and run `pod install`: `NSAllowsArbitraryLoads` and `NSAllowsLocalNetworking` are added as expected.
2. Modify `NSAppTransportSecurity` to only contain `NSExceptionDomains` and run `pod install`: `NSAllowsArbitraryLoads` and `NSAllowsLocalNetworking` are added, and `NSExceptionDomains` is still there.
3. Run `pod install` again: nothing changes.

Reviewed By: christophpurrer

Differential Revision: D52032400

Pulled By: dmytrorykun

fbshipit-source-id: 48cf29809c283af80613ffbf1ac0dc663a0a2fb5
  • Loading branch information
robertying authored and facebook-github-bot committed Dec 11, 2023
1 parent e4887a5 commit a0b76d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-native/scripts/cocoapods/utils.rb
Expand Up @@ -541,7 +541,8 @@ def self.update_ats_in_plist(plistPaths, parent)
"NSAppTransportSecurity" => ats_configs
}
else
plist["NSAppTransportSecurity"] = ats_configs
plist["NSAppTransportSecurity"] ||= {}
plist["NSAppTransportSecurity"] = plist["NSAppTransportSecurity"].merge(ats_configs)
end
Xcodeproj::Plist.write_to_path(plist, fullPlistPath)
end
Expand Down

0 comments on commit a0b76d9

Please sign in to comment.