Post not yet marked as solved
At present, we can create an NSXPC listener in a launch agent process which a sandboxed app extension can communicate with via the com.apple.security.temporary-exception.mach-lookup.global-name entitlement.
If I were to pass an NSXPCListener endpoint to this XPC service can the app extension act as a listener for incoming connections from the launch agent process? Will the sandbox impose restrictions on this?
I have noticed this issue on BigSur that did not happen on Catalina:
An app is attempting to establish a network connection, despite the following entitlements:
<key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.network.client</key> <false/>
An outbound firewall is preventing it, but my understanding is that these entitlements should prevent entirely the app from making connections.
Has this changed under BigSur?
Post not yet marked as solved
Hey,
I have my working photogrammetry command line app. Plz help me embedding this app into my other macOS GUI app. I have completed my GUI app, just need to connect both the apps.
What is the appropriate way ?
Post not yet marked as solved
Is there a feature available to sandbox profiles that would allow a suid program (in this particular case, /bin/ps) to be exec-ed without privilege (with the uid of exec-ing process instead of uid of file owner.)
Currently, trying to launch gives error:
sandbox-exec: execvp() of '/bin/ps' failed: Operation not permitted
With logged message:
deny(1) forbidden-exec-sugid
If I make a copy of /bin/ps, thus removing the suid-bit, it does run ok in the sandbox. However, it would be more convent if I could just tell the sandbox environment to allow the exec without elevating privilege.
Yes, I understand sandbox-exec has been DEPRECATED for quite a while, and the profile language is "Apple System Private Interface", but I thought I'd ask anyway. Thanks.
Post not yet marked as solved
I have an app that is distributed through the Mac App Store, and so is sandboxed. I need to fetch processor temperature, so some of its new features function correctly. Since fetching temperature is not possible in a sandboxed app, I was looking for a workaround. One idea that I'm investigating right now is having a helper app, which would not be sandboxed, be distributed separately, but be installed from the main app as a helper tool.
Is that possible? Is that gonna pass the App Store review?
Post not yet marked as solved
I am running a safari web extension and sending a message from the JavaScript to the app extension.
The beginRequest method takes in an NSExtensionContext which has the inputItems property. This changes the structure of the JSON string coming in, which I do not want. Is there a way to avoid the restructuring and keep the original JSON intact?
Post not yet marked as solved
I do have a strange problem on porting my application to BigSur MacOS. The Application is Intel code, the machine does have an M1 CPU.
Application is sandboxed, the file in question is an embedded FirebirdSQL database created by application. File is located in an subdirectory inside sandbox-container.
Error does happen on writing first data page after creation of empty file. The executable is stopped by "Abort trap: 6" error, the file is left at size 0.
Any Idea what might cause the problem and how to avoid?
Elmar
Post not yet marked as solved
Hi folks,
I'm trying to build communication between the main app and its helper via inter-process communication.
I found here that it is possible if the apps are in the same app group. But I really cannot make it work, and cannot understand what I do wrong. It works all good if I add com.apple.security.temporary-exception.mach-lookup.global-name entitlement, so the setup seems to be correct? Where should I look to fix it? Also because having that entitlement means that it is gonna be tricky to get through the App Review.
I'm trying to export a text document in the Documents directory and running into file permission problem in a Mac app that does not use the App Sandbox. As a workaround for the issue, I tried turning on the App Sandbox and giving read/write access to the Documents directory, but when I add the App Sandbox capability, I have the following entries for file access:
User Selected File
Downloads Folder
Pictures Folder
Music Folder
Movies Folder
Since the file is a text file, exporting to any of the folders in the list makes no sense. If I give User Selected File read/write access, I still get file permission errors when I export. The UI in Xcode provides no way to add folders to the File Access list.
All I want to do is let someone export a file in the folder of their choice. How do I do this with the App Sandbox?
UPDATE
I'm developing a SwiftUI app. I was using SwiftUI's file exporter to export the document. I took robnotyou's suggestion to use NSSavePanel, but I still get the file permission error, with or without the App Sandbox. I get the following message in Xcode's console:
Error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file
If I turn on the App Sandbox, give the Downloads folder read/write permission, and export the document there, the file permissions issue goes away.
I'm running macOS 11.5.2. If I open the Privacy preferences in System Preferences and select Files and Folders, I can see that some previous apps I developed appear in the list and have a checkbox selected that grants the app access to the Documents folder. The list of apps has an Add button, but it's disabled.
I tried giving this app full disk access and adding it to the Developer Tools list of apps that can run software locally that does not meet the system's security policy. But the file permission error persists.
I'm exporting the file in a folder inside the Documents directory. The file has read/write access for my user account and my group. The Documents folder has custom access when I get info on the folder in the file.
How do I get around this file permission error?
Post not yet marked as solved
I am trying to build an App with File Provider finder extension (*.appex) with Xcode 12.5 (12E262) on macOS Big Sur 11.3.
The app and its plugin work well when I execute them with "Product -> Run" in Xcode. The sync folder create by File Provider locates at the Finder sidebar and users are able to manipulate files.
However, if I take the App built by Xcode and execute at somewhere else, the extension in App may not be started by fileproviderd as before.
Observations
I create two folders in my home folder, which are ~/fileprovider-1 and ~/.fileprovider-2.
The only different is that the second folder name starts with dot . and would not be seen in Finder (invisible).
Put my App in ~/fileprovider-1
Everything works, File Provider extension is launched and files are enumerated in that sync location.
Put my App in ~/.fileprovider-2
Nothing happened, only Main App is started. File Provider extension doesn't do anything.
After checking the log I found some deny error which doesn't print in the case 1:
Main App: /Users/allen/.fileprovider-2/Drive.app
Extension App: /Users/allen/.fileprovider-2/Drive.app/Contents/PlugIns/DriveProvider.appex
2021-09-15 17:14:44.882366+0800 0x34ce3 Default 0x2b638 440 0 pkd: [com.apple.PlugInKit:ls] [u 5574EECF-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX] [com.test.allen.Drive.DriveProvider(1.0)] plugin INSTALLED; bundleID: [com.test.allen.Drive.DriveProvider], path: [/Users/allen/.fileprovider-2/Drive.app/Contents/PlugIns/DriveProvider.appex], contained in [com.test.allen.Drive]
2021-09-15 17:14:44.909224+0800 0x344ca Error 0x2a9fe 541 0 fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [ERROR] Failed to create descriptor for extension <EXConcreteExtension: 0x7f8c98f2c620> {id = com.test.allen.Drive.DriveProvider}
2021-09-15 17:14:44.909173+0800 0x344ca Error 0x0 0 0 kernel: (Sandbox) Sandbox: fileproviderd(541) deny(1) file-read-data /Users/allen/.fileprovider-2/Drive.app/Contents/PlugIns/DriveProvider.appex
2021-09-15 17:14:44.910654+0800 0x344ca Default 0x2a9fe 541 0 fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [WARNING] no root reachable for provider <FPDProvider:0x7f8c9a063bc0 "com.test.allen.Drive.DriveProvider" uuid:"(null)">, skipping
Problem
I have no idea why folder name starts with . may make this difference.
Changing the entitlements in Main App / Extension App may not help, because the denied process is fileproviderd and it's not controlled by us.
Is there any method to avoid this problem? Any suggestions or comments are welcomed.
Best,
Allen
Post not yet marked as solved
Hi, Is there a way for a macOS Sandboxed Application distributed via App Store to determine if macOS is managed or not? The profiles command doesn't give expected results for a sandboxed application. Is there an alternative to achieve the same?
Post not yet marked as solved
Hi All,
I have a NEDNSProxyProvider System Extension and my logs are full of sandbox violations, all like:
error 2021-09-21 10:42:30.557390 -0400 sandboxd com.apple.sandbox.reporting violation System Policy: com.myCompany.mac(640) deny(1) system-privilege 10006
Violation: deny(1) system-privilege 10006
Process: com.myCompany.mac [640]
Path: /Library/SystemExtensions/4375ED6E-69A9-4897-8B39-4252AD9843AD/com.myCompany.macos.netext.dnsproxy.systemextension/Contents/MacOS/com.myCompany.macos.netext.dnsproxy
Load Address: 0x1028a8000
Identifier: com.myCompany.macos.netext.dnsproxy
Version: 78 (2.0.0)
Code Type: arm64 (Native)
Parent Process: launchd [1]
Responsible: /Library/SystemExtensions/4375ED6E-69A9-4897-8B39-4252AD9843AD/com.myCompany.macos.netext.dnsproxy.systemextension/Contents/MacOS/com.myCompany.macos.netext.dnsproxy
User ID: 0
Date/Time: 2021-09-21 10:42:30.522 EDT
OS Version: macOS 11.6 (20G165)
Report Version: 8
MetaData: {"uid":0,"summary":"deny(1) system-privilege 10006","errno":1,"hardware":"J293","operation":"system-privilege","apple-internal":false,"pid":640,"platform-binary":false,"primary-filter":"privilege-id","privilege-id":"PRIV_NET_PRIVILEGED_NECP_MATCH","process":"com.myCompany.mac","profile-flags":0,"target":"PRIV_NET_PRIVILEGED_NECP_MATCH","build":"macOS 11.6 (20G165)","flags":5,"team-id":"7NM7G573E4","platform-policy":true,"profile":"platform","responsible-process-path":"\/Library\/SystemExtensions\/4375ED6E-69A9-4897-8B39-4252AD9843AD\/com.myCompany.macos.netext.dnsproxy.systemextension\/Contents\/MacOS\/com.myCompany.macos.netext.dnsproxy","signing-id":"com.myCompany.macos.netext.dnsproxy","platform_binary":"no","action":"deny","process-path":"\/Library\/SystemExtensions\/4375ED6E-69A9-4897-8B39-4252AD9843AD\/com.myCompany.macos.netext.dnsproxy.systemextension\/Contents\/MacOS\/com.myCompany.macos.netext.dnsproxy","normalized_target":["PRIV_NET_PRIVILEGED_NECP_MATCH"],"primary-filter-value":"PRIV_NET_PRIVILEGED_NECP_MATCH"}
Thread 0 (id: 5185):
0 libsystem_kernel.dylib 0x0000000195f13eac __sigsuspend_nocancel + 8
1 libdispatch.dylib 0x0000000195dab518 _dispatch_sigsuspend + 48
2 libdispatch.dylib 0x0000000195dab4e8 _dispatch_sigsuspend + 0
Thread 1 (id: 32979):
0 libsystem_kernel.dylib 0x0000000195f0ea8c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000195f438e8 _pthread_wqthread + 352
2 libsystem_pthread.dylib 0x0000000195f425d4 start_wqthread + 8
Thread 2 (id: 33109):
0 libsystem_kernel.dylib 0x0000000195f1111c socket + 8
1 libnetwork.dylib 0x0000000199d74658 nw_interface_create_with_index_and_name + 220
2 libnetwork.dylib 0x0000000199d73c7c nw_interface_create_with_index + 180
3 NetworkExtension 0x00000001a310de10 -[NEAppProxyFlow initWithNEFlow:queue:] + 432
4 NetworkExtension 0x00000001a310fc70 -[NEAppProxyUDPFlow initWithNEFlow:queue:] + 48
5 NetworkExtension 0x00000001a31425b8 -[NEExtensionAppProxyProviderContext flowDivertNewFlow:completionHandler:] + 556
6 NetworkExtension 0x00000001a31419f8 __88-[NEExtensionAppProxyProviderContext setInitialFlowDivertControlSocket:extraValidation:]_block_invoke.106 + 72
7 NetworkExtension 0x00000001a3172404 __flow_startup_block_invoke.116 + 156
8 libdispatch.dylib 0x0000000195d96128 _dispatch_call_block_and_release + 32
9 libdispatch.dylib 0x0000000195d97ec0 _dispatch_client_callout + 20
10 libdispatch.dylib 0x0000000195d9f6a8 _dispatch_lane_serial_drain + 620
11 libdispatch.dylib 0x0000000195da02a4 _dispatch_lane_invoke + 404
12 libdispatch.dylib 0x0000000195daab74 _dispatch_workloop_worker_thread + 764
13 libsystem_pthread.dylib 0x0000000195f4389c _pthread_wqthread + 276
14 libsystem_pthread.dylib 0x0000000195f425d4 start_wqthread + 8
Thread 3 (id: 33293):
0 libsystem_kernel.dylib 0x0000000195f0ea8c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000195f438e8 _pthread_wqthread + 352
2 libsystem_pthread.dylib 0x0000000195f425d4 start_wqthread + 8
Thread 4 (id: 33296):
0 0x0000000000000000
Binary Images:
0x195d94000 - 0x195dd8807 libdispatch.dylib (1271.120.2) <4edd5f72-2296-3891-b2a1-6741db6c05c9> /usr/lib/system/libdispatch.dylib
0x195f0c000 - 0x195f3ffff libsystem_kernel.dylib (7195.141.6) <fa7e835c-cb30-3d98-9331-30ce6584423d> /usr/lib/system/libsystem_kernel.dylib
0x195f40000 - 0x195f4cfff libsystem_pthread.dylib (454.120.2) <bdc1c5da-9499-3580-9588-2928de2440dd> /usr/lib/system/libsystem_pthread.dylib
0x199ba7000 - 0x19a2ef4ff libnetwork.dylib (2288.140.7) <992e11c6-a4c3-344f-80f9-d49fc41f9ebb> /usr/lib/libnetwork.dylib
0x1a3104000 - 0x1a335a1b3 com.apple.NetworkExtension (1.0 - 1) <66650680-34df-30c9-a215-46589cf2aa0e> /System/Library/Frameworks/NetworkExtension.framework/Versions/A/NetworkExtension
and related
error 2021-09-21 10:42:41.145014 -0400 kernel <Missing Description> System Policy: com.myCompany.mac(640) deny(1) system-privilege 10006
OS: macOS 11.6, sysext built with Xcode 12.5.1
The proxy works as expected.
I've found a very similar post: here but the System extension is a NETransparentProxyManager and the solution is related to something we don't have (includeAllNetworks)
Any clue?
Is it possible to create a non-sandboxed app for iOS, that will actually install and run, via manual build/sign process?
Ie. via xcodebuild/codesign with custom provisioning profile. It seems xcode IDE does not allow to disable sandboxing for iOS apps.
App failing the AppStore review is not an issue - do not intend to distribute it.
Post not yet marked as solved
I am working on a sandboxed app. The application contains few other helper apps. I am getting pids and path of these running helper apps using following APIs :
proc_listpids() proc_pidpath()
But the system is not allowing above calls and gives following error on Console :
Sandbox: MyAppName (14156) deny(1) process-info-listpids
How can we avoid this restriction via any entitlement ?
Post not yet marked as solved
I have a sandboxed, document-based app. Things usually work as intended, but sometimes the app crashes with EXC_BAD_ACCESS, after producing multiple sandbox errors.
I haven't found any information about the specific errors or on how to avoid them.
[scoped] handle 0: sandbox_extension_release error [22: Invalid argument]
Appname [96446:12385639] [scoped] <0x600002e4ba20 file:///....(url here)>: internal sandbox error for <StopAccessing>
Appname[96446:12386186] [scoped] Scoped bookmarks can only be created for existing files or directories
Appname[96446:12386810] [default] sandbox_extension_consume returned 12
sandbox_extension_consume returned 12
sandbox_extension_consume returned 12
... ad nauseam
I'm not using any custom writing methods in my NSDocument subclass and the URL that it has accessed before stopping access, does in fact exist.
The most cryptic error is sandbox_extension_consume returned 12. There is no information about it available anywhere, and until recently, it didn't cause any problems, but now it has started crashing the app, giving the aforementioned bad access.
What am I doing wrong and where? What is sandbox_extension_consume and why does it return 12?
Post not yet marked as solved
Hi,
I have developed a Shortcuts action for the new Shortcuts of macOS 12. I've created a custom intent and an Intents extension. My action receives one or more files as input. The file type has been set to a custom UTI com.adobe.pdf. However the files cannot be opened. I can see in the Console that Sandbox denies the access.
If I handle the intent directly in my main app with func application(_ application: NSApplication, handlerFor intent: INIntent) -> Any? I can only open files that have been opened by the main app before. If I handle the intent in an app extension I can't open any file at all. Both the main app and the extension are sandboxed with com.apple.security.files.user-selected.read-only set to 1. My app is singed with my valid developer ID.
The example Shortcut workflow I've build simply receives PDFs as an input and is set-up to work as a Quick Action. But no matter which Shortcut configuration I choose, it does not seem to make a difference.
Interestingly everything works as expected if I set com.apple.security.files.downloads.read-write to 1. Of cause that only works with the Downloads folder.
My question: How do I have to configure my app and/or app extension in order to work with files that have been opened in Shortcuts and given to my Shortcut action as an input parameter.
Cheers and thanks for your help
Post not yet marked as solved
I need to read the tags assigned to a file, if I use the code shown below on cli tools projects everything works fine, the identical code executed from sandboxed apps returns only the first element
NSDictionary<NSURLResourceKey, id>* dict = [[NSURL fileURLWithPath:@"absolute_file_path"] resourceValuesForKeys:@[NSURLTagNamesKey] error:nil];
NSLog(@"Result %@", dict);
The same with swift, running the code from playground the result is correct, running it from swift sandboxed app only the first element is returned
Is this a bug?
Post not yet marked as solved
Is it still possible? If so, what developer has to do to get this permission from Apple?
I see some apps use features that does not work when sandbox is enabled, to be specific, accessibility related. Some of those apps are quite new, so it is not about legacy apps.
Post not yet marked as solved
I've just bought a new MacBook Pro M1, and restored everything from my old Intel MacBook Pro using a Time Machine backup.
It was a pretty smooth process, a few glitches such as needing to re-download certain apps to get the M1 version (e.g. Android Studio).
One thing that I've noticed, and I don't know whether this is a Monterey thing or an M1 thing but as part of my day-to-day development work, I maintain various .sh files for building projects on different platforms.
I have found that as soon as I edit and save an existing .sh file using TextEdit, it then sets the quarantine bit on the file and prevents it running from inside Zsh:
zsh: operation not permitted: ./test.sh
xattr yields the following:
xattr ./test.sh
com.apple.TextEncoding
com.apple.lastuseddate#PS
com.apple.macl
com.apple.metadata:kMDLabel_pjtfm5adga5rvjv2xmgkyqjwmq
com.apple.quarantine
This is incredibly annoying and I can't believe it is by design - this is not a file that has been downloaded from the Internet, it's my own file. Why can't I edit it using TextEdit?
I do not get the same problem when I edit and save using Sublime Text, as one example, so what's with TextEdit doing that?
Hi,
Is there a way to get access to the user's document directory, except the usual way of asking for access using "com.apple.security.files.user-selected.read-write"?
I am looking for something like "com.apple.security.files.downloads.read-write" but with access to the documents directory instead.
Regards,