General:
DevForums tag: App Sandbox
App Sandbox documentation
App Sandbox Design Guide documentation — This is no longer available from Apple. There’s still some info in there that isn’t covered by the current docs but, with the latest updates, it’s pretty minimal (r. 110052019). Still, if you’re curious, you can consult an old copy [1].
App Sandbox Temporary Exception Entitlements archived documentation — To better understand the role of temporary exception entitlements, see this post.
Embedding a Command-Line Tool in a Sandboxed App documentation
Discovering and diagnosing App Sandbox violations (replaces the Viewing Sandbox Violation Reports DevForums post)
Resolving App Sandbox Inheritance Problems DevForums post
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] For example, this one archived by the Wayback Machine.
App Sandbox
RSS for tagApp Sandbox is a macOS access control technology designed to contain damage to the system and user data if an app becomes compromised.
Posts under App Sandbox tag
122 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello,
I’m developing a sandboxed macOS app using Qt, which will be distributed via the Mac App Store. The app:
Monitors the clipboard to store copied items.
Overrides the paste function of the operating system via keyboard shortcuts.
Modifies clipboard content, replacing what the user pastes with stored data.
So, I have some questions:
Can a sandboxed app continuously read and modify clipboard content?
What entitlements are required?
What permissions should I request from the user to ensure that my app works?
Any guidance would be greatly appreciated!
Thanks in advance!
Beril Bayram
Not sure if my question is weird or not, but I didnt find any documentation about an sdks access to an apps documents directory.
Im assuming that because sdk is part of the sandbox that it can access and read from the documents directory? i.e. if i used
NSFileManager.defaultManager.URLForDirectory(
directory = NSCachesDirectory,
inDomain = NSUserDomainMask,
appropriateForURL = null,
create = false,
error = null,
)
to write a file called "file.txt", then any sdk my app used has the ability to access the contents of said directory?
If yes, why isnt this considered something more worth mentioning? usually in filemanager tutorials they never warn about this.
FYI: Im asking more for iOS and iPadOs then MacOs.
hey everyone.!!
In one of my macOS projects I am trying to fetch the files and folders available on "Desktop" and "Document" folder and trying to showing it on collection view inside the my project, but when I try to fetch the files and folder of desktop and document, I am not able to fetch it. But if i try it by setting the entitlements False, I am able to fetch it.
If any have face the similar issue, or have an alternative it please suggest.
NOTE:- I have tried implementing it using NSOpenPanel and it works, but it lowers the user experience.
I created an app in Xcode using ApplescriptObjC that is supposed to communicate with Finder and Adobe Illustrator. It has been working for the last 8 years, until now I have updated it for Sonoma and it no longer triggers the alerts for the user to approve the communication. It sends the Apple Events, but instead of the alert dialog I get this error in Console:
"Sandboxed application with pid 15728 attempted to lookup App: "Finder"/"finder"/"com.apple.finder" 654/0x0:0x1d01d MACSstill-hintable sess=100017 but was denied due to sandboxing."
The Illustrator error is prdictably similar.
I added this to the app.entitlements file:
<key>com.apple.security.automation.apple-events</key>
<array>
<string>com.apple.finder</string>
<string>com.adobe.illustrator</string>
</array>
I added this to Info.plist:
<key>NSAppleEventsUsageDescription</key>
<string>This app requires access to Finder and Adobe Illustrator for automation.</string>
I built the app, signed with the correct Developer ID Application Certificate.
I've also packaged it into a signed DMG and installed it, with the same result as running it from Xcode.
I tried stripping it down to just the lines of code that communicate with Finder and Illustrator, and built it with a different bundle identifier with the same result.
What am I missing?
Hi,
Apple changed the renewal rate for auto renewable subscriptions in testflight to 24hrs and after 6 renewals it is supposed to expire. My subscription is now active for more than 13 days, it didnt expire as its supposed to. I heard that there is no chance to cancel it manually. Is there anyone else who had this problem and found a solution? I use RevenueCat to manage subscriptions. Maybe its because they have not adapted to apples update yet. Are there any other RevenueCat users that can confirm this experience? Or non RC users who don't have the issue I'm facing? Any responds are welcome.
I did an in app purchase in my development app and now I cannot get rid of it. It is a "monthly" subscription that seems to renew every 1 day.
I can see the subscription when I go to settings then tap on Subscriptions.
Then I tap the item and choose "Cancel Subscription", revealing a new modal sheet saying "Confirm Cancellation".
When I "Confirm", I get the popup:
"Your request is temporarily unable to be processed, please try again later".
However, this is anything BUT temporary, has gone on for a couple weeks now.
As such, I am unable to test subscriptions in my development app.
I've tried logging out, restarting, different devices, etc.
The phone is logged in under my primary user account, and I may not have been logged into sandbox email when I did the purchase.
Can someone forcibly remove it for me?
I am developing a macOS word-processing app that should be distributed via the Apple App Store. Some of the app's functions like generating HTML and PDF exports should be automatable via Shortcuts and via shell scripts.
To support the latter, I plan to include a command line tool inside the app that can be called from the Terminal or a shell script. The tool should be able to instruct the main app to then perform the desired commands.
A well-known AppStore app that uses this design is BBEdit which also contains multiple command line tools that offer functionality from the main app to users of the Terminal.
My technical questions now are:
Should the command line tool executable be sandboxed and if yes, how?
Even after many trials, I have not found a way to make a working sandboxed command line tool. If a sandboxed tool is started from the Terminal, it is immediately terminated with an exception in _libsecinit_appsandbox.cold.12. I am aware of the Apple developer documentation article Embedding A Helper Tool In A Sandboxed App, but it addresses a different architecture in which the helper tool is started from the main app and therefore is able to inherit its sandbox.
BBEdit is only sandboxing the main app, but not its embedded command line tools and is still allowed in the App Store. Is this the way to go for me as well or does BBEdit get some special treatment in the App Store?
How can the command line tool pass the permission to access files to the main app?
As my main app is sandboxed, it needs explicit permission from the user to be able to access files. Users of a command line tool give this permission by providing file paths as arguments. How can I pass these permissions along to the main app? BBEdit is able to do this even when the user has not given it full-disk access. I know that it is using Apple Events for the communication between the command line tool and the main app, but I am not sure how this allows to pass permissions. Can anyone shed light on how to implement a solution here?
Thanks!
Hi, I am trying to build a command line app that read local mov files and print the text to the terminal. When I open the file with VNImageRequestHandler(url: url), where the url is a hardcode path to my desktop file, the terminal reports CRImage Reader Detector was given zero-dimensioned image (0 x 0). Anyone can help? Thanks!
Greetings! I want to add my pre-compiled binary of v2ray to my application so I can activate it in background as a proxy and run stuff through it.
I've codesigned it via:
codesign -s - -i production.myproject.v2ray -o runtime --entitlements v2ray.entitlements -f v2ray
Contents of entitlements file:
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
Originally I ran it like this without sandboxing from my main target app:
guard let v2rayPath = Bundle.main.path(forResource: "v2ray", ofType: nil) else {
throw NSError(domain: "ProxyController", code: 1, userInfo: [NSLocalizedDescriptionKey: "V2Ray binary not found in bundle"])
}
let task = Process()
task.executableURL = URL(fileURLWithPath: v2rayPath)
task.arguments = ["-config", configURL.path]
// Redirect output for debugging
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe```
And it ran flawlessly. Now it refuses to start. Any help, pointers or examples of such usage will be greatly appreciated
Hello, first time poster here.
I'm struggling to find any info/documentation on why bluetooth game controllers DON'T require bluetooth entitlement when app sandboxing is enabled but do require USB.
any pointers would be much appriciated
Chris
Firstly, I realise that Kexts are deprecated. And for my needs, user-space IOKit from an application might be more than I’ll ever need, but I can’t help ensuring I’ve got all my ducks in a row while I’m designing an app.
I noticed in the above Kext deprecation notice that it’s more about specific APIs that are deprecated rather than the kext mechanism itself (no mention of IOKit kernel APIs there). Along with the fact that a reboot would be required and various other policy changes.
While reading up on System Extensions and the various newer tools, DriverKit, Endpoint Security etc, I’ve noticed there’s no mention of this “IOKit Driver” target/deliverable in the Xcode template chooser. It looks like, from the requirements, that DriverKit is aimed at hardware manufacturers, with a need to request the DriverKit entitlement for development.
With respect to Apple’s internal Kext deprecation roadmap, how safe is it to build a product that relies on using an IOKit Driver and are there any requirements similar to DriverKit? Would a developer need to request an entitlement?
If I developed an app using user-space IOKit and, for illustration purposes let’s say I also included an IOKit Driver in the app bundle. If I used the IOKit API, including header file constants only (no digging around in the IORegistryExplorer for non-public keys), as Apple intends them to be used, would this fall foul of any App Store rules that anyone is aware of?
Put another way, would making use of an IOKit Driver disqualify my app from being distributed via the App Store, similar to an Endpoint Security extension?
As an aside, there are a lot of API in the ES Framework that could be used to build apps that have nothing to do with Endpoint Security. File system related apps for example. It’s a shame there isn’t an enhanced middle ground between FSEvents and Endpoint Security framework.
there is a functional issue that I hope to receive your help
Background: When my app is running, it will monitor the USB devices currently connected to the Mac and obtain the hid related configurations for each USB device, such as:
{vendorId: 10168,
productId: 493,
path: 'IOService:/ AppleACPIPl...HIDDevice@14210000 0 serialNumber: '20002E8C',
manufacturer: 'ThingM',
product: 'blink(1) mk2',
release: 2,
interface: -1,
usagePage: 65280,
usage: 1}
Originally running normally, but in sandbox mode, I found that there were some missing information in obtaining device information, specifically the path of each USB device obtained (e.g. 'IOService:/ AppleACPIPl...HIDDevice@14210000 0 ') are all lost (with empty content), but they can be obtained in non sandbox environments. Do i need any additional permissions for this?
PS: I have been keeping it on:
com. apple. security. device. usb
I have a werid case that shouldn't happen according to https://forums.developer.apple.com/forums/thread/706390
I have an audio unit which runs in FCP and I want it to launch a sandboxed app as a child process.
If I sign the child app with just "com.apple.security.app-sandbox" entitlement it crashes with SYSCALL_SET_PROFILE error.
According to the article referenced above: "This indicates that the process tried to setup its sandbox profile but that failed, in this case because it already has a sandbox profile."
This makes sense because audio units run in a sandboxed environment (in AUHostingService process).
So I added "com.apple.security.inherit" to the entitlements plist and now I get "Process is not in an inherited sandbox." error.
According to the article referenced above: "Another cause of a trap within _libsecinit_appsandbox is when a nonsandboxed process runs another program as a child process and that other program’s executable has the com.apple.security.app-sandbox and com.apple.security.inherit entitlements. That is, the child process wants to inherit its sandbox from its parent but there’s nothing to inherit."
And this doesn't make sense at all. The first error indicates the child process is trying to create a sandboxed environment within a parent sandboxed environment while the second error indicates there's no a parent sandboxed environment...
I specifically checked the child process has "com.apple.security.app-sandbox" and "com.apple.security.inherit" entitlements only.
If I remove all entitlements from the child process it launches and runs fine from the audio unit plugin. And if I remove "com.apple.security.inherit" but leave "com.apple.security.app-sandbox" I can successfully launch the app in standalone mode (in Finder).
For the testing puroses I use a simple Hello World desktop application generated by XCode (Obj-C).
Does anybody have an idea what can be the reason for such a weird behavior?
If a user applies for and is approved for a subscription refund by Apple, we understand that the developer can receive a server notification of "REFUND."
However, this notification doesn't include the refund amount.
Therefore, we thought about linking the refund amount information output in the financial report "All Countries or Regions (Detailed)" with individual end-user transaction information.
However, it seems that this report doesn't have a transaction ID, and the records appear to be aggregated daily.
Is there any way we can find out how much was refunded to which user for individual refunds?
If a user applies for a subscription refund from Apple, are there cases where only a part of the plan, rather than the full amount, is refunded?
I've written a little utility targeting Mac, for personal use. In it, I need to be able to select a file from an arbitrary location on my drive.
I have the "user selected file" entitlement added, and I have added my application to "Full Disk Access." But I still get a permissions error when I select a file with the file-open dialog (via .fileImporter).
I dragged the application from the Xcode build directory to Applications before adding it to Full Disk Access. Any ideas?
I am developing a macOS app that requires the ability to create new files in the same directory as a user-selected file, but I am encountering permission issues due to the App Sandbox restrictions. While the user can select a file (e.g., a.jpg) using a standard open panel, I cannot create an adjacent file (e.g., a.jxl) in the same folder because the sandbox only grants access to the selected file, not to other files in the directory.
I understand that full disk access might be an option, but it requires user intervention and isn't suitable for this case. Is there any way to extend access to other files in the directory (including those not selected by the user) while remaining within the App Sandbox environment?
Hi, this is my app:
https://macsyzones.com
Here, a video that demonstrates my app:
https://www.youtube.com/watch?v=0jNx3ZUD8Rw
It's a very cute window management app with unique features. It needs Accessibility Permission but App Store requires App Sandbox enabled which makes to request Accessibility Permission impossible.
How can I submit my app without App Sandbox enabled to Apple?
Apple can review the code and build it themselves? There are apps that uses Accessibility Permissions on App Store as I can see. Hope you help to have my app on App Store, it will be very good. 😇
I hope you'll give my app a place on App Store. 🥳
Thank you.
Project Background:
I developed a Mac project using Electron and VSCode
Successfully uploaded the packaged pkg using Transporter,
However, I will receive an email informing me that there are some issues with the project:
ITMS-90296: App sandbox not enabled - The following executors must include the 'com. apple. security. app sandbox' entitlement with a Boolean value of true in the entitlement property list: [[com. electron. iflyrecclient. pkg/Payload/iFlytek Listen. app/Contents/MacOS/iFlytek Listen]]
ITMS-90886: 'Cannot be used with TestFlight because the signature for the bundle at' iFlytek hears. app 'is missing an application identifier but has an application identifier in the provisioning profile for the bundle.' Bundles with application identifiers in the provisioning profile are expected to have the same identifier signed into the bundle in order to be eligible for TestFlight.'
Here is my packaging process:
Generate an app using the electron packager tool
Sign the app using @ electron osx sign (version 1.3.1)
After signing, use
productbuild - component Yourappname App/Applications - sign "3rd Party Mac Developer Installer: * * * * * (XXXXXXXXXX)" Yourappname. pkg
command generates pkg
PS:
For the second step, I have set sand box=true in both entitlents.plist and entitlents.macinheriting. plist. And after signing, using
codesign -dvvv -- entitiements - /path
to view the app file shows' checkbox=true ', and the [iFlytek Listen. app/Contents/MacOS/iFlytek Listen] file in the issue also exists.
Using the Suspicious Package software to view pkg also has sandbox=true.
A few months ago, I uploaded it once and the issues mentioned in the email did not appear. The only changes were the macOS system version number and the replacement of the signature with provisionprofileprovisionprofile.
I have reviewed similar issues on the Apple Developer Forums, but have not been resolved
Hello!
I encountered an issue while packaging and uploading the project to the Mac store. I received an email stating:
ITMS-90296: App Sandbox not enabled - The following executors must include the 'com. apple. security. app sandbox' entitlement with a Boolean value of true in the entitlement property list: [[com. electron. iflyrecclient. pkg/Payload/iFlytek Listen. app/Contents/MacOS/iFlytek Listen]] Refer to App Sandbox page at https://developer.apple.com/documentation/security/app_sandbox for more information on sandboxing your app.
Though you are not required to fix the following issues, we wanted to make you aware of them:
ITMS-90886: 'Cannot be used with TestFlight because the signature for the bundle at' iFlytek hears. app 'is missing an application identifier but has an application identifier in the provisioning profile for the bundle.' Bundles with application identifiers in the provisioning profile are expected to have the same identifier signed into the bundle in order to be eligible for TestFlight.'
But in my memory, the sandbox was set to true. I have also tried the methods in the forum, but they have not been resolved,I hope you can help me see what happened. Here are the specific situations I developed,
This project is built and developed using electron9;
The entire project was not developed using Xcode;
The specific process of packaging into pkg is as follows:
Step 1: Use an electron packager to package the app file
Step 2: Use electron/osx sign to sign the entire app file (with options such as entitlement and provisioning profile configured)
Step 3: Use the productbuild -- component Yourappname. app/Applications -- sign "3rd Party Mac Developer Installer: *** *** (XXXXXXXXXX)" Yourappname. pkg command to generate the pkg package
Step 4: Upload to transporter
The above operations were executed normally, and after the second step of signing, using the codesign dvvv -- entities -provided on the official website to query also showed that the sandbox was true. However, after the upload was successful, you will receive an email showing an issue, and the corresponding uploaded version cannot be found on the app connect website
Hope to receive your answer. Wishing you good health and smooth work!
PS: When generating the app, there is no sandbox related configuration in Info.Plist in the app content package. Is this normal? I checked the info.Plist of Google Chrome, Sogou Input Method and other software, and there is no sandbox configuration. Moreover, I tried manually adding it and then packaging it, but also encountered the same email problem.
When my macOS app (currently in TestFlight and set for Mac App Store distribution) tries to terminate another app, both terminate() and forceTerminate() consistently return false. However, I can retrieve a list of all running applications so some related APIs do work.
I suspect this limitation is due to sandboxing. I have three questions:
Is there any permission or entitlement I can add in Xcode to allow my app to terminate other applications?
If no such permission exists, is there a way to guide users on how to launch my app (distributed through the Mac App Store) without sandboxing? For example, could they set it up to launch as a daemon or agent?
If unsandboxing is impossible, would I need to create a separate target specifically without sandboxing? In other words, my MacOS app would communicate with my unsandboxed daemon that would do all the terminate()-ing?