Преглед изворни кода

Add privacy manifest (#3792)

### Issue Link :link:
[Apple's update to their API policy - Required
Reason](https://github.com/Alamofire/Alamofire/issues/3761)

### Goals :soccer:
To comply with Apple's new privacy policies every app and third-party
SDK should include a Privacy manifest in case if they access APIs which
potentially can be used for fingerprinting. All use cases of such API
require explicit reasons declaration.
Alamofire accesses `systemUptime` property which is included in a
required reasons API.

### Implementation Details :construction:
- Added a PrivacyInfo.xcprivacy file. The file requires all four fields
to be included:
  - SDK does not use tracking;
- Tracking domains array is empty. It can be empty as long as tracking
is false;
  - SDK does not collect any data. NSPrivacyCollectedDataTypes is empty;
- SDK uses `systemUptime`, Reason: [35F9.1: Measure time on-device, per
documentation](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278394)
- Updated package.swift file to include the privacy manifest to the SP.

### Testing Details :mag:
Not applicable
Dmitry Kuleshov пре 1 година
родитељ
комит
7eb18428e2
3 измењених фајлова са 27 додато и 1 уклоњено
  1. 2 0
      Alamofire.xcodeproj/project.pbxproj
  2. 2 1
      Package.swift
  3. 23 0
      Source/PrivacyInfo.xcprivacy

+ 2 - 0
Alamofire.xcodeproj/project.pbxproj

@@ -613,6 +613,7 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		0AEC95C92AF5419400CD241A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
 		3106FB6023F8C53A007FAB43 /* ProtectedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProtectedTests.swift; sourceTree = "<group>"; };
 		3106FB6423F8D9E0007FAB43 /* DataStreamTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStreamTests.swift; sourceTree = "<group>"; };
 		3111CE8720A77843008315E2 /* EventMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventMonitor.swift; sourceTree = "<group>"; };
@@ -1199,6 +1200,7 @@
 			isa = PBXGroup;
 			children = (
 				F8111E3719A95C8B0040E7D1 /* Info.plist */,
+				0AEC95C92AF5419400CD241A /* PrivacyInfo.xcprivacy */,
 			);
 			name = "Supporting Files";
 			sourceTree = "<group>";

+ 2 - 1
Package.swift

@@ -41,7 +41,8 @@ let package = Package(name: "Alamofire",
                                                                           .when(platforms: [.iOS,
                                                                                             .macOS,
                                                                                             .tvOS,
-                                                                                            .watchOS]))]),
+                                                                                            .watchOS]))]
+                                        resources: [.copy("PrivacyInfo.xcprivacy")]),
                                 .testTarget(name: "AlamofireTests",
                                             dependencies: ["Alamofire"],
                                             path: "Tests",

+ 23 - 0
Source/PrivacyInfo.xcprivacy

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>NSPrivacyTracking</key>
+	<false/>
+	<key>NSPrivacyTrackingDomains</key>
+	<array/>
+	<key>NSPrivacyCollectedDataTypes</key>
+	<array/>
+	<key>NSPrivacyAccessedAPITypes</key>
+	<array>
+		<dict>
+			<key>NSPrivacyAccessedAPIType</key>
+			<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
+			<key>NSPrivacyAccessedAPITypeReasons</key>
+			<array>
+				<string>35F9.1</string>
+			</array>
+		</dict>
+	</array>
+</dict>
+</plist>