crasowas / app_store_required_privacy_manifest_analyser

A shell script used to analyze privacy manifests in the specified directory to ensure that your app complies with the App Store requirements.
MIT License
162 stars 16 forks source link
appstore itms-91053 nsprivacyaccessedapicategoryactivekeyboards nsprivacyaccessedapicategorydiskspace nsprivacyaccessedapicategoryfiletimestamp nsprivacyaccessedapicategorysystemboottime nsprivacyaccessedapicategoryuserdefaults privacy-manifest required-reason-api

App Store Privacy Manifest Analyzer

Analysis Support license

A shell script used to analyze privacy manifests in the specified directory to ensure that your app complies with the App Store requirements.

Features

Requirements

You can try executing the following command to determine if your Mac device supports the script:

xcrun swift -version

If the output after execution resembles the example below:

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)

Congratulations! You are now ready to start using the script. Should you encounter any other issues, you can attempt to install Xcode Command Line Tools using the following command:

xcode-select --install

Usage

1. Getting Started

sh privacy_manifest_analyser.sh <directory_path>

Example output:

============================ Analyzing Runner Project ============================

šŸ’” Found privacy manifest file(s): 1
[0] ./Runner/PrivacyInfo.xcprivacy
API usage analysis result(s): 0
āœ… All required API reasons have been described in the privacy manifest.

======================== Analyzing CocoaPods Dependencies ========================

Analyzing FBSDKCoreKit šŸŽÆ ...
šŸ’” Found privacy manifest file(s): 3
[0] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-simulator/FBSDKCoreKit.framework/PrivacyInfo.xcprivacy
[1] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-maccatalyst/FBSDKCoreKit.framework/Versions/A/Resources/PrivacyInfo.xcprivacy
[2] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/PrivacyInfo.xcprivacy
API usage analysis result(s): 3
[0] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/FBSDKCoreKit
[1] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-maccatalyst/FBSDKCoreKit.framework/FBSDKCoreKit
[2] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-simulator/FBSDKCoreKit.framework/FBSDKCoreKit
āœ… All required API reasons have been described in the privacy manifest.

Analyzing DKImagePickerController šŸŽÆ ...
āš ļø  Missing privacy manifest file!
API usage analysis result(s): 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp:.modificationDate:./Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageAssetExporter.swift
šŸ› ļø  Descriptions for the following required API reason(s) may be missing: 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp

Analyzing SDWebImage šŸŽÆ ...
šŸ’” Found privacy manifest file(s): 1
[0] ./Pods/SDWebImage/WebImage/PrivacyInfo.xcprivacy
API usage analysis result(s): 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp:NSURLContentModificationDateKey,NSURLCreationDateKey:./Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m
āœ… All required API reasons have been described in the privacy manifest.

Analyzing Mantle ...
āš ļø  Missing privacy manifest file!
API usage analysis result(s): 0

...

========================= Analyzing Flutter Dependencies =========================

Analyzing device_info_plus-9.1.0 šŸŽÆ ...
āš ļø  Missing privacy manifest file!
API usage analysis result(s): 0

Analyzing shared_preferences_ios-2.1.1 šŸŽÆ ...
āš ļø  Missing privacy manifest file!
API usage analysis result(s): 3
[0] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults,NSUserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/FLTSharedPreferencesPlugin.m
[1] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.h
[2] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.m
šŸ› ļø  Descriptions for the following required API reason(s) may be missing: 1
[0] NSPrivacyAccessedAPICategoryUserDefaults

...

========== Analysis completed! ā°: 229s šŸ’”: 6 āš ļø : 30 šŸ› ļø : 10 āœ…: 6 šŸŽÆ: 10 ===========

āš ļø šŸ› ļø  https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api
šŸŽÆ https://developer.apple.com/support/third-party-SDK-requirements

šŸ”” If the directory you are analyzing is the app project directory, your app's privacy manifest may be affected by these analysis results: 20
[0] NSPrivacyAccessedAPICategoryFileTimestamp:.modificationDate:./Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageAssetExporter.swift
[1] NSPrivacyAccessedAPICategoryFileTimestamp:NSURLContentModificationDateKey,NSURLCreationDateKey:./Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m
[2] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults,NSUserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/FLTSharedPreferencesPlugin.m
[3] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.h
[4] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.m
...

āš ļø šŸ› ļø: When the privacy manifest of third-party SDKs is missing, please update the third-party SDKs or provide feedback to the developers.

If your app's code has the same issue, please refer to the following documents or video for resolution:

šŸŽÆ: Please promptly update these commonly used SDKs highlighted by the App Store. The complete list is from Upcoming third-party SDK requirements.

šŸ””: For non-dynamically linked libraries, they are fully copied into the executable file of the application bundle during compilation, which may result in unknown API usage when scanning the executable file of the application.

To pass the App Store review, you need to declare the APIs used by these non-dynamically linked libraries in your app's privacy manifest. You might feel confused as you are not sure where exactly these APIs are being used.

To address this confusion, the analyzer will list API usage that may affect your app's privacy manifest. Pay attention to it, as it will help you fill out the app's privacy manifest more accurately.

2. Command Line Options

sh privacy_manifest_analyser.sh -c <directory_path>

It is not recommended to enable this option for the accuracy of API scanning.

sh privacy_manifest_analyser.sh -d <dependencies_directory_path> <directory_path>

Local dependencies will be analyzed separately, just like dependencies from CocoaPods, SwiftPM, Carthage, and so on.

sh privacy_manifest_analyser.sh -e <excluded_directory_path> <directory_path>
sh privacy_manifest_analyser.sh -i <directory_path>

This option is typically used for the analysis of Swift Package Manager projects. Please refer to: ios_swiftpm_example.

sh privacy_manifest_analyser.sh -v <directory_path>

3. Saving Analysis Log

sh privacy_manifest_analyser.sh <directory_path> > log.txt

Supported Dependency Sources for Separate Analysis

Dependency Source Example
CocoaPods ios_example
Swift Package Manager ios_swiftpm_example
Carthage ios_carthage_example
Flutter flutter_example
Application Bundle Planned

Acknowledgements