Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xcprivacy privacy manifest to iOS framework #48951

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -9330,6 +9330,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist
FILE: ../../../flutter/shell/platform/darwin/ios/framework/PrivacyInfo.xcprivacy
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h
Expand Down
11 changes: 11 additions & 0 deletions shell/platform/darwin/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ copy("copy_framework_module_map") {
outputs = [ "$_flutter_framework_dir/Modules/module.modulemap" ]
}

# Copy privacy manifest. This file is required by Apple for third-party SDKs,
# and documents engine and third_party usage of timestamps and boot time APIs.
# See https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
copy("copy_framework_privacy_manifest") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment linking to https://developer.apple.com/documentation/bundleresources/privacy_manifest_files here to provide context on what this is and why we are doing it?

Although developer.apple.com links are notoriously fragile, so 🤷🏻

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't explain Info.plists, or modulemaps, or the values within those files, or any other thing we move around in this gn file. In 2 years when you Google "PrivacyInfo.xcprivacy" you'll see the most relevant info, and when you git blame you'll find this PR with my thorough description. However adding the link is harmless so I'll do that.

visibility = [ ":*" ]
sources = [ "framework/PrivacyInfo.xcprivacy" ]
outputs = [ "$_flutter_framework_dir/PrivacyInfo.xcprivacy" ]
}

action("copy_framework_headers") {
script = "//flutter/sky/tools/install_framework_headers.py"
visibility = [ ":*" ]
Expand Down Expand Up @@ -415,6 +424,7 @@ shared_library("copy_and_verify_framework_module") {
":copy_framework_headers",
":copy_framework_info_plist",
":copy_framework_module_map",
":copy_framework_privacy_manifest",
]

if (darwin_extension_safe) {
Expand All @@ -437,6 +447,7 @@ group("universal_flutter_framework") {
":copy_framework_icu",
":copy_framework_info_plist",
":copy_framework_module_map",
":copy_framework_privacy_manifest",
":copy_license",
]

Expand Down
34 changes: 34 additions & 0 deletions shell/platform/darwin/ios/framework/PrivacyInfo.xcprivacy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only wonder if someone of these review comments are better suited as <!-- comments -->, particularly ones with confusing semantics (i.e. that an array of an empty dict means "we are not tracking or collecting").

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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>
<dict/>
</array>
Comment on lines +5 to +12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False and empty, we are not tracking or collecting.

<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>0A2A.1</string>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare this reason if your third-party SDK is providing a wrapper function around file timestamp API(s) for the app to use, and you only access the file timestamp APIs when the app calls your wrapper function. This reason may only be declared by third-party SDKs. This reason may not be declared if your third-party SDK was created primarily to wrap required reason API(s). Information accessed for this reason, or any derived information, may not be used for your third-party SDK’s own purposes or sent off-device by your third-party SDK.

<string>C617.1</string>
Copy link
Member Author

@jmagman jmagman Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For app state restoration in FlutterAppDelegate.mm:

Declare this reason to access the timestamps, size, or other metadata of files inside the app container, app group container, or the app’s CloudKit container.

[[[NSBundle mainBundle] executableURL] getResourceValue:&fileDate
forKey:NSURLContentModificationDateKey
error:&error];

</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare this reason to access the system boot time in order to measure the amount of time that has elapsed between events that occurred within the app or to perform calculations to enable timers. Information accessed for this reason, or any derived information, may not be sent off-device. There is an exception for information about the amount of time that has elapsed between events that occurred within the app, which may be sent off-device.

</array>
</dict>
</array>
</dict>
</plist>