Entitlement Key Reference
Entitlement Key Reference
Reference
Contents
About Entitlements 5
At a Glance 5
Enable iCloud for Sharing Data Among Devices 6
Enable Push Notifications for Alerting the User 6
Enable App Sandbox to Minimize Damage from Malicious Code 6
Use App Sandbox Temporary Exceptions, If Needed 6
Prerequisites 6
See Also 7
2
Contents
3
Tables
4
About Entitlements
At a Glance
Set entitlement values in order to enable iCloud, push notifications, and App Sandbox. Each entitlement has
a default value, which in most cases disables the capability associated with the entitlement. When you set an
entitlement, you are overriding the default by providing an appropriate key-value pair.
● iCloud entitlements let you enable the use of iCloud data storage for your iOS or OS X app.
You set iCloud entitlement values on a target-by-target basis in your Xcode project.
● Push notifications let your app alert the user even when your iOS or OS X app is not executing.
You set push notification entitlement values as part of configuring your development and distribution
provisioning profiles.
● App Sandbox entitlements let you enable the security feature called sandboxing for your OS X app. (In
iOS, all apps are sandboxed automatically, so these sandboxing entitlements do not apply.)
By carefully enabling only the resource access that you need, you minimize the potential for damage if
malicious code successfully exploits your app. You set App Sandbox entitlement values on a target-by-target
basis in your Xcode project.
You can set many entitlements using the Summary tab of the Xcode target editor. Other entitlements require
editing a target’s entitlements property list file. Finally, a few entitlements are inherited from the iOS provisioning
profile used to run the app.
The sort of value to associate with an entitlement key depends on the key. Many entitlement keys take Boolean
values. For entitlements defined in a property list in an Xcode project, a Boolean entitlement value is either
<true/> or <false/>. Some entitlement keys take a string or an array of strings as a value. Refer to the
chapters in this document for specifics on the values to apply to the various entitlement keys.
To use any entitlement keys, you must code sign your app because an app’s entitlements are built in to its
code signature.
5
About Entitlements
Prerequisites
Prerequisites
Understand where entitlements fit into the development process by reading App Programming Guide for iOS
or Mac App Programming Guide .
You set iCloud and App Sandbox entitlement values using Xcode. For an introduction to Xcode, read Xcode
Overview .
6
About Entitlements
See Also
See Also
When adding iCloud features to your app, be sure to read iCloud Design Guide .
When adding push notification capability to your app, refer to Local and Remote Notification Programming
Guide .
When configuring your sandbox, use this document in concert with App Sandbox Design Guide .
7
Enabling iCloud Storage
To enable your app to use iCloud document or key-value storage, set values for the appropriate entitlements
using Xcode.
As the value for this entitlement, provide an array of one or more strings. One of these strings must be the
bundle identifier for your app, or for another app that you submit using the same team identifier. In the
.entitlements file, this string has the following form:
$(TeamIdentifierPrefix)com.mycompany.myapplication
If you are using the graphical interface of the Xcode target editor to provide a value for the iCloud container
entitlement, there is no need to include the $(TeamIdentifierPrefix) variable. Xcode supplies the prefix
in the .entitlements file automatically.
If you want to confer access to documents created by other apps published by your team, use additional strings
to specify the bundle identifiers of those apps.
You must not use a wildcard (“*”) character in the string for an iCloud container entitlement value.
8
Enabling iCloud Storage
Enabling iCloud Key-Value Storage
As the value for this entitlement key, provide the bundle identifier for your app, such as:
$(TeamIdentifierPrefix)com.mycompany.myapplication
If you are using the graphical interface of the target editor to provide a value for the iCloud key-value store
entitlement, there is no need to include the $(TeamIdentifierPrefix) variable. Xcode supplies the prefix
in the .entitlements file automatically.
9
Enabling Push Notifications
To enable your app to alert the user through push (also known as remote ) notifications, set a value for the
appropriate entitlement.
For a complete discussion about push notifications, see Local and Remote Notification Programming Guide .
The following table shows the push notification entitlement keys that apply to the iOS and OS X platforms:
The entitlement key is different for iOS than it is for OS X. On either platform, however, the provisioning portal
assigns a value of development or production to the key, depending only on which activity you are creating
the provisioning profile for.
10
Enabling App Sandbox
Note: This chapter describes property list keys specific to the OS X implementation of App Sandbox.
They are not available in iOS.
In your OS X Xcode project, configure fine-grained security permissions by enabling settings in the Summary
tab of the target editor. These settings, in turn, add Boolean values to entitlement keys in the target’s
.entitlements property list file. The values are then incorporated into the target’s code signature when you
build the project.
At runtime, if a target requires a capability or a system resource for which the target isn’t entitled, the sandbox
daemon (sandboxd) logs a violation message to the console.
For more information about App Sandbox, read App Sandbox Design Guide .
The value to use for any of these keys is a Boolean YES or NO, with the default value in each case being NO. If
you are editing the .entitlements file directly in a text editor, the corresponding Boolean values to use are
<true/> and <false/>. The default value for each key is false, so you can (and generally should) leave out
the entitlement entirely rather than specifying a false value.
In cases where there are read-only and read/write entitlement key pairs, use of either key in the pair is mutually
exclusive with the other.
Add these keys by using the Summary tab of the Xcode target editor. You can also add them directly to a
target’s .entitlements file with the Xcode property list editor.
11
Enabling App Sandbox
App Sandbox Entitlement Keys
For information on additional entitlements for handling special circumstances, see App Sandbox Temporary
Exception Entitlements (page 26).
For each key in this table, providing a Boolean value of YES enables the corresponding capability (unless
otherwise noted).
12
Enabling App Sandbox
App Sandbox Entitlement Keys
13
Enabling App Sandbox
App Sandbox Entitlement Keys
14
Enabling App Sandbox
App Sandbox Entitlement Keys
15
Enabling App Sandbox
Enabling App Sandbox
com.apple.security.print Printing
For details, see Enabling Hardware
Access (page 20).
16
Enabling App Sandbox
Enabling User-Selected File Access
To learn how to enable App Sandbox for your OS X app, which includes performing code signing, see App
Sandbox Quick Start in App Sandbox Design Guide . The essential step is to ensure that the target editor checkbox
named in Table 3-1 is selected.
Certain other user interactions, such as dragging items to your app or choosing items from the Open Recent
menu, automatically expand your sandbox to include those items. Similarly, when OS X resumes an app after
a reboot, the sandbox is automatically expanded to include any items that are automatically opened.
To enable user-selected file access in your app, use the Xcode target editor setting shown in Table 3-2.
17
Enabling App Sandbox
Enabling Access to Files in Standard Locations
Note: If your app needs to create executable files that are typically executed in some way other
than through Launch Services (shell scripts, for example), you should also specify the
com.apple.security.files.user-selected.executable entitlement.
By default, when writing executable files in sandboxed apps, the files are quarantined. Gatekeeper
prevents quarantined executable files and other similar files (shell scripts, web archives, and so on)
from opening or executing unless the user explicitly launches them from Finder.
If those executables are tools that are intended to run from the command line, such as shell scripts,
this presents a problem. With this flag, the file quarantine system allows the app to write
non-quarantined executables so that Gatekeeper does not prevent them from executing.
This entitlement does not have an Xcode checkbox, and thus must be added to your app’s entitlement
property list manually. For details, see App Sandbox Entitlement Keys (page 11).
Table 3-2 Xcode setting for user-selected file and folder access
The Xcode control for enabling Downloads folder access is a checkbox; the controls for enabling access to
these other folders are pop-up menus.
When you enable programmatic access to the user’s Movies folder, you also gain access to their iTunes movies.
Reopening of files by OS X using Resume does not require the presence of any entitlement key.
To enable programmatic access to specific folders, use the Xcode target editor settings shown in Table 3-3.
18
Enabling App Sandbox
Enabling Security-Scoped Bookmark and URL Access
Table 3-3 Xcode settings for programmatic file and folder access
For more information on security-scoped bookmarks, read Security-Scoped Bookmarks and Persistent Resource
Access in App Sandbox Design Guide .
Table 3-4 Entitlement keys for enabling security-scoped bookmark and URL access
19
Enabling App Sandbox
Enabling Network Access
To enable your app to connect to a server process running on another machine (or on the same machine),
enable outgoing network connections.
To enable opening a network listening socket so that other computers can connect to your app, allow incoming
network connections.
Note: Both outgoing and incoming connections can send and receive data. The sole difference is
in whether your app is initiating the connection or is receiving connections initiated by other apps
or other hosts.
To enable network access, use the Xcode target editor settings shown in Table 3-5.
To enable access to hardware, use the Xcode target editor settings shown in Table 3-6.
20
Enabling App Sandbox
Enabling Hardware Access
To allow access to hardware devices for which no checkbox exists in Xcode’s user interface, you must manually
add the appropriate entitlement to your app’s entitlements property list. These additional entitlements are
listed in Table 3-7 (page 21). All of these keys take a Boolean value.
21
Enabling App Sandbox
Enabling Personal Information Access
To enable access to personal information, use the Xcode target editor settings shown in Table 3-8.
In addition, this attribute allows the apps within the group to share Mach and POSIX semaphores and to use
certain other IPC mechanisms among the group’s members. For additional details and naming conventions,
read “Mach IPC and POSIX Semaphores and Shared Memory” in App Sandbox Design Guide .
The value for this key must be of type array, and must contain one or more string values, each of which
must consist of your development team ID, followed by a period, followed by an arbitrary name chosen by
your development team. For example:
<key>com.apple.security.application-groups</key>
<array>
<string>DG29478A379Q6483R9214.HolstFirstAppSuite</string>
<string>DG29478A379Q6483R9214.HolstSecondAppSuite</string>
22
Enabling App Sandbox
Enabling App Sandbox Inheritance
</array>
The group containers are automatically created or added into each app’s sandbox container as determined
by the existence of these keys. The group containers are stored in ~/Library/Group
Containers/<application-group-id>, where <application-group-id> is one of the strings from
the array. Your app can obtain the path to the group containers by calling the
containerURLForSecurityApplicationGroupIdentifier: method of NSFileManager.
Important: XPC (as described in External Tools, XPC Services, and Privilege Separation) complements App
Sandbox and is the preferred technology for implementing privilege separation in an OS X app. Before
using a child process, consider using an XPC service instead.
To enable sandbox inheritance, a child target must use exactly two App Sandbox entitlement keys:
com.apple.security.app-sandbox and com.apple.security.inherit. If you specify any other App
Sandbox entitlement, the system aborts the child process. You can, however, confer other capabilities to a
child process by way of iCloud and notification entitlements.
The main app in an Xcode project must never have a YES value for the inherit entitlement.
To add the inherit entitlement, edit the target’s .entitlements property list file using the Xcode property
list editor. Use the entitlement key shown in Table 3-9 with a value of <true/>.
23
Enabling App Sandbox
Enabling Scripting of Other Apps
Note: This property causes the child process to inherit only the static rights defined in the main
app’s entitlements file, not any rights added to your sandbox after launch (such as PowerBox access
to files).
If you need to provide access to files opened after launch, you must either pass the data to the helper
or pass a bookmark to the child process. The bookmark need not be a security-scoped bookmark,
but it can be, if desired.
If you are using other APIs to create child processes (such as NSWorkspace) and wish to have a
shared container directory, you must use an app group.
Table 3-9 Entitlement key for inheriting the parent process’s App Sandbox
Note: Before you can use this entitlement, the scriptable app must provide scripting access groups.
If it does not, you can still control the app, but you must use a temporary exception, as described in
Apple Event Temporary Exception (page 26).
24
Enabling App Sandbox
Enabling Scripting of Other Apps
The scripting target entitlement contains a dictionary where each entry has the target app’s code signing
identifier as the key, and an array of scripting access groups as the value. Scripting access groups are identified
by strings and are specific to an app. For example, the following entry would grant access to composing mail
messages with Apple’s Mail app:
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.mail</key>
<array>
<string>com.apple.mail.compose</string>
</array>
</dict>
For more information about how to add scripting access groups to an app, watch WWDC 2012: Secure Automation
Techniques in OS X and read the manual page for sdef.
25
App Sandbox Temporary Exception Entitlements
Note: This chapter describes property list keys specific to the OS X implementation of App Sandbox.
They are not available in iOS.
A temporary exception entitlement permits your OS X app to perform certain operations otherwise disallowed
by App Sandbox.
If you need to request a temporary exception entitlement, use Apple’s bug reporting system to let Apple know
what’s not working for you. Apple considers feature requests as it develops the OS X platform.
Note: If you request a temporary-exception entitlement, be sure to follow the guidance regarding
entitlements provided on the iTunes Connect website. In particular, identify the entitlement and
corresponding issue number in the App Sandbox Entitlement Usage Information section in iTunes
Connect and explain why your app needs the exception.
To request a temporary exception entitlement for a target in an OS X Xcode project, add it to the target’s
.entitlements property list file using the Xcode property list editor.
The value to provide for any temporary exception entitlement is a string or an array of one or more strings.
For more information on using temporary exceptions in OS X, refer to Designing for App Sandbox in App
Sandbox Design Guide .
However, with App Sandbox you cannot send Apple events to other apps unless you configure a
scripting-targets entitlement or an apple-events temporary exception entitlement.
26
App Sandbox Temporary Exception Entitlements
Audio Unit Hosting Temporary Exception
The scripting-targets entitlement is the preferred way to request the ability to send Apple events to apps
that provide scripting access groups. This entitlement is described in App Sandbox Entitlement Keys (page
11).
This entitlement contains an array of strings, each of which should contain the bundle identifier of an app you
want to send Apple events to, with all characters in the bundle identifier converted to lowercase. For example,
to enable sending Apple events to iPhoto from your app, you would pass an array containing a single string
whose value is com.apple.iphoto.
27
App Sandbox Temporary Exception Entitlements
File Access Temporary Exceptions
For each path that you want to enable access to, specify the path as a string value for the appropriate entitlement
key’s value array. Each string must start with a slash (/) character—whether it represents an absolute path or
a path relative to the user’s home directory. If a path you provide specifies a directory rather a file, you must
end the path with a slash character.
● For a home-relative-path temporary exception, provide a path relative to the user’s home directory;
that is, relative to ~
● For an absolute-path temporary exception, provide an absolute path; that is, relative to /
28
App Sandbox Temporary Exception Entitlements
File Access Temporary Exceptions
com.apple.security.temporary-exception.files.home-relative-path.read-only Enables
read-only
access to the
specified files
or
subdirectories
in the user’s
home
directory.
com.apple.security.temporary-exception.files.home-relative-path.read-write Enables
read/write
access to the
specified files
or
subdirectories
in the user’s
home
directory.
com.apple.security.temporary-exception.files.absolute-path.read-only Enables
read-only
access to the
specified files
or directories
at specified
absolute
paths.
29
App Sandbox Temporary Exception Entitlements
Shared Preference Domain Temporary Exceptions
com.apple.security.temporary-exception.files.absolute-path.read-write Enables
read/write
access to the
specified files
or directories
at specified
absolute
paths.
com.apple.security.temporary-exception.shared-preference.read-write Enables
read/write access
to the contents
of the specified
preference
domain or
domains in the
user’s home
directory.
30
Document Revision History
Date Notes
2012-09-19 Added a new section for obtaining access to shared preferences, Shared
Preference Domain Temporary Exceptions (page 30).
2012-07-20 Added a description of the app group entitlement key, in Adding an App
to an App Group (page 22).
31
Document Revision History
Date Notes
2011-09-28 New document that describes the entitlement keys for App Sandbox,
iCloud, and push notifications.
32
Apple Inc.
Copyright © 2014 Apple Inc.
All rights reserved.