Skip to content

Commit

Permalink
ios: Add privacy manifest, copying deps' reasons for "required reason…
Browse files Browse the repository at this point in the history
… APIs"

Apple has a new requirement to declare reasons for using certain
potentially privacy-sensitive APIs. It calls these "required reason
APIs":
  https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api?language=objc
Starting May 1, we risk being prevented from publishing until we
properly do that: zulip#5847.

We don't have much iOS code of our own, and none of it uses these
APIs (I've checked). But some of our dependencies do, and we have to
handle that.

Specifically, we expect to have to aggregate the declared reasons of
all our dependencies that use these APIs, and declare them ourself.
(That is, of dependencies that are statically linked -- which we
expect them to be, since we don't call `use_frameworks!` in our
Podfile.) The dependencies declare them with a "privacy manifest"
file, and the place we declare them is in a privacy manifest of our
own.

Below are the reasons we're copying over, noted with the
dependencies that declare them:

---- File timestamp APIs ----

(rn-fetch-blob uses some of these APIs, but that project hasn't yet
merged a privacy manifest. Currently the only reason code we haven't
declared in this category is DDA9.1, and I don't think that applies.
The Apple doc says, "Declare this reason to display file timestamps
to the person using the device," and we don't do that.)

C617.1: "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."

  @react-native-async-storage/async-storage (using the privacy
    manifest from the later version we take in zulip#5856, which is not
    yet merged as of writing)

  @sentry/react-native

  expo-application (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

  react-native (using the privacy manifest added very recently in
    facebook/react-native@d39712f54, which we haven't taken because
    RN upgrades take a lot of effort)

0A2A.1: "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."

  expo-file-system (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

3B52.1: "Declare this reason to access the timestamps, size, or
  other metadata of files or directories that the user specifically
  granted access to, such as using a document picker view
  controller."

  expo-file-system (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

---- System boot time APIs ----

35F9.1: "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."

  @sentry/react-native

  react-native (using the privacy manifest added very recently in
    facebook/react-native@d39712f54, which we haven't taken because
    RN upgrades take a lot of effort)

---- Disk space APIs ----

(rn-fetch-blob uses some of these APIs, but that project hasn't
merged a privacy manifest yet. Currently the only reasons we haven't
declared in this category are 7D9E.1 and B728.1, and I don't think
those apply.)

85F4.1: "Declare this reason to display disk space information to
  the person using the device. Disk space may be displayed in units
  of information (such as bytes) or units of time combined with a
  media type (such as minutes of HD video).

  Information accessed for this reason, or any derived information,
  may not be sent off-device. There is an exception that allows the
  app to send disk space information over the local network to
  another device operated by the same person only for the purpose of
  displaying disk space information on that device; this exception
  only applies if the user has provided explicit permission to send
  disk space information, and the information may not be sent over
  the Internet."

  expo-file-system (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

E174.1: "Declare this reason to check whether there is sufficient
  disk space to write files, or to check whether the disk space is
  low so that the app can delete files when the disk space is low.
  The app must behave differently based on disk space in a way that
  is observable to users.

  Information accessed for this reason, or any derived information,
  may not be sent off-device. There is an exception that allows the
  app to avoid downloading files from a server when disk space is
  insufficient."

  expo-file-system (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

---- User defaults APIs ----

(expo-error-recovery uses some of these APIs, but that project
hasn't merged a privacy manifest yet, and we don't expect it to
because it is deprecated and not used in recent versions of Expo;
see expo/expo@87ffd749a. I don't *think* our app ends up using
expo-error-recovery; its README makes it sound like something we
would be aware of if it were active: "`expo-error-recovery` helps
you gracefully handle crashes caused by fatal JavaScript errors.".)

CA92.1: "Declare this reason to access user defaults to read and
  write information that is only accessible to the app itself.

  This reason does not permit reading information that was written
  by other apps or the system, or writing information that can be
  accessed by other apps."

  @sentry/react-native

  expo-constants (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

  expo-file-system (using the privacy manifest added recently in
    expo/expo@b8e40614b, which we haven't taken because Expo
    upgrades take a lot of effort)

  react-native (using the privacy manifest added very recently in
    facebook/react-native@d39712f54, which we haven't taken because
    RN upgrades take a lot of effort)
  • Loading branch information
chrisbobbe committed Apr 22, 2024
1 parent 5fa3ce6 commit eb14e9f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions ios/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>3B52.1</string>
<string>0A2A.1</string>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
<string>85F4.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</array>
</dict>
</plist>
4 changes: 4 additions & 0 deletions ios/ZulipMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
8B44AB40295B7D4D003D41A8 /* ZLPConstantsBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B44AB3F295B7D45003D41A8 /* ZLPConstantsBridge.m */; };
8BD55E9B295CB7A10091C181 /* ZLPNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD55E9A295CB61E0091C181 /* ZLPNotifications.swift */; };
8BD55E9C295CB7A10091C181 /* ZLPNotificationsBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD55E99295CB61E0091C181 /* ZLPNotificationsBridge.m */; };
8BDD410B2BD1C8F80030774C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 8BDD410A2BD1C8F80030774C /* PrivacyInfo.xcprivacy */; };
8BE55043253A2B6600B0BC8A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8BE55041253A2B6600B0BC8A /* LaunchScreen.storyboard */; };
A148FEFC1E9D8CB900479280 /* zulip.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = A148FEFB1E9D8CB900479280 /* zulip.mp3 */; };
A65C1ECEE03CA6692FC807AA /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C68E38F2AA306A2C56A4B3 /* ExpoModulesProvider.swift */; };
Expand All @@ -41,6 +42,7 @@
8B44AB3F295B7D45003D41A8 /* ZLPConstantsBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ZLPConstantsBridge.m; path = ZulipMobile/ZLPConstantsBridge.m; sourceTree = "<group>"; };
8BD55E99295CB61E0091C181 /* ZLPNotificationsBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ZLPNotificationsBridge.m; path = ZulipMobile/ZLPNotificationsBridge.m; sourceTree = "<group>"; };
8BD55E9A295CB61E0091C181 /* ZLPNotifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ZLPNotifications.swift; path = ZulipMobile/ZLPNotifications.swift; sourceTree = "<group>"; };
8BDD410A2BD1C8F80030774C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
8BE55042253A2B6600B0BC8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = ZulipMobile/Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
A148FEFB1E9D8CB900479280 /* zulip.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = zulip.mp3; sourceTree = "<group>"; };
CFA67D1F1EC23BCB0070048E /* UtilManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UtilManager.m; path = ZulipMobile/UtilManager.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -112,6 +114,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
8BDD410A2BD1C8F80030774C /* PrivacyInfo.xcprivacy */,
42689E9B23466FF7007540AA /* webview */,
A148FEFB1E9D8CB900479280 /* zulip.mp3 */,
13B07FAE1A68108700A75B9A /* ZulipMobile */,
Expand Down Expand Up @@ -238,6 +241,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8BDD410B2BD1C8F80030774C /* PrivacyInfo.xcprivacy in Resources */,
8B40B9F327F7AEEC00D33897 /* zulip-icons.ttf in Resources */,
42689E9C23466FF7007540AA /* webview in Resources */,
13B07FBF1A68108700A75B9A /* Assets.xcassets in Resources */,
Expand Down

0 comments on commit eb14e9f

Please sign in to comment.