App Sandbox

RSS for tag

App 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

200 Posts

Post

Replies

Boosts

Views

Activity

App Sandbox Resources
General: Forums subtopic: Privacy & Security > General Forums 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 forums post) Resolving App Sandbox Inheritance Problems forums post The Case for Sandboxing a Directly Distributed App forums post Implementing Script Attachment in a Sandboxed App forums 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.
0
0
3.7k
Jul ’25
Launching a signed AppKit app from a Python supervisor while preserving instance ownership and bounded cleanup
I'm looking for a supported way to launch a signed AppKit application for user interaction from a local Python supervisor, while retaining reliable supervision of the exact launched instance. Environment Apple M3 MacBook Air, macOS 14.5, build 23F79. arm64 app built with Command Line Tools clang and the macOS 14.5 SDK, targeting macOS 14.0. AppKit/Foundation with embedded CPython 3.12. Apple Development signing, hardened runtime and strict signature checks passed. Current launch and activation sequence The supervisor directly launches the bundle executable with Popen: a fixed argument, empty environment, new process session, disconnected stdin, and an anonymous stdout pipe carrying fixed, nonsecret startup markers. There is no LaunchServices foreground handoff. On its main thread, the app initializes NSApplication, confirms Regular activation policy, calls finishLaunching and activateIgnoringOtherApps:YES, then waits for isActive. Event-retrieval waits are capped at 20 ms; event dispatch itself may take longer. Existing timeout supervision remains active. Our activation guard is two seconds from the readiness routine's start, subject to the remaining native timer. A separate overall test budget is 300 seconds from operator readiness, before preflight. Observed result The latest test exited with code 1 after approximately 2.57 seconds. The validated markers were: absence.begin → absence.absent → fields.begin → ui.begin → app.shared.begin → app.shared.ready → policy.before → policy.already_regular → policy.postcondition → launch.finish.begin → launch.finish.ready → activation.requested → activation.wait.begin → stop.activation.timeoutThe final recorded state was: main=1 app=1 active=0 policy=0 window=0 visible=-1 key=-1The app stopped before constructing the dialog. Adding event processing did not resolve activation. We have not established why activation failed or which events were delivered. The two-second deadline is our guard, not an asserted macOS activation guarantee. Questions What supported launch and activation approach should this supervisor use for a foreground, interactive AppKit app? Can this direct-executable design be corrected narrowly, or should launching move to LaunchServices with a different communication and supervision arrangement? With the recommended approach, how should the supervisor identify the exact launched instance, receive startup status, enforce bounded termination, and establish that the process has exited before cleanup? We reviewed a simple foreground-launch substitution, but it did not preserve our existing marker pipe and authoritative exit/reap evidence. That is a limitation of our proposed adaptation, not a claim that Apple's APIs cannot support these outcomes. The essential requirements are exact-instance identification, nonsecret status reporting, bounded termination and verified cleanup. An anonymous pipe and direct-child waiting are current implementation choices, not requirements in themselves.
6
0
134
1d
Supported termination of a specific unresponsive embedded XPC service instance
We are evaluating a signed macOS launcher app with an embedded XPC service. The service would own a VZVirtualMachine. Before permitting VM startup, the launcher must bind the admitted job to the actual service instance and establish any required termination authority. We need clarification on the following: Is there a public, supported mechanism for the containing app to terminate that specific service instance if it becomes unresponsive, including before its first application-level reply? If so, what API, signing, sandbox, entitlement, and authorization conditions apply? How can the termination target remain bound to that instance despite PID reuse or service regeneration? Is transfer of a task-control right from the service to the launcher, followed by task_terminate, supported for this purpose? If it requires the service to respond first, is there a supported alternative for a pre-reply hang? What supported observation confirms termination of that same process instance, separately from acceptance of a termination request? What lifecycle behavior applies if the containing launcher itself terminates unexpectedly? We understand from threads 848542 and 850709 that Virtualization is expected to reclaim a guest after its owner exits, but provides neither a teardown timeline guarantee nor a successor-process guest-completion handle. We are not requesting such a guarantee or treating service exit as proof of completed VM reclamation. Please identify applicable documentation and any platform-version restrictions.
2
0
77
1d
Access to related files outside Sandbox with NSFileCoordinator and NSFilePresenter does not work anymore in macOS 27.3 beta 2
In macOS 27.3 beta 2, it is no longer possible to use NSFileCoordinator with NSFilePresenter instances to open a SQLite file with related WAL and SHM files when a sandboxed app has access to the primary SQLite file. In macOS 27.3 beta 1 and previous macOS releases, the Related File Access API works as expected. This happens regardless where the files are located, so it seems to be unrelated to recent changes in Privacy & Security, although it could be an unexpected side effect of these changes. Instead of correctly registering NSFilePresenter instances, errors like the following are logged in the XCode console: NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for /Users/testuser/Desktop/Sample/Example.sqlite-wal because: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (The related item is protected by a different storage class than the primary item) UserInfo={NSDebugDescription=The related item is protected by a different storage class than the primary item} +[NSFileCoordinator addFilePresenter:] could not get a sandbox extension. primaryPresentedItemURL: file:///Users/testuser/Desktop/Sample/Example.sqlite, presentedItemURL: file:///Users/testuser/Desktop/Sample/Example.sqlite-walThe mentioned Related File Access API is documented here. I have filed a Feedback, which includes a sample project: FB25625743 My question is: Is this a bug, or new intended behavior, or is there something else changed that should be dealed with when using this API in macOS 27.3 beta 2?
1
0
70
3d
Can macOS verify a worker’s effective sandbox policy before it runs?
I’m building a local app on an Apple silicon Mac. Before a worker or any of its child processes can run, I need to verify the worker’s effective filesystem and network restrictions, including inherited restrictions. I need to allow that same pending launch only if the policy matches, and deny it if verification fails or times out. I reviewed Apple’s App Sandbox guidance and the Endpoint Security documentation for exec authorization and entitlement metadata. I haven’t found documentation showing that these expose the complete effective policy for the pending launch. Is there a supported public macOS API that provides this guarantee? If so, which API and macOS versions support it? If not, is this outside what the public APIs can verify?
1
0
201
3d
Can a Mac App Store (sandboxed) app create and delete VLAN interfaces with SCVLANInterfaceCreate?
We make a Mac App Store app that runs virtual machines with the Virtualization framework. It has the com.apple.vm.networking entitlement and already bridges VMs to physical interfaces through VZBridgedNetworkDeviceAttachment. We'd like users to manage 802.1Q VLAN interfaces from inside the app, so they can create a VLAN on an Ethernet port and bridge a VM to it. The SystemConfiguration API for this is: var auth: AuthorizationRef? var item = AuthorizationItem(name: "system.services.systemconfiguration.network", valueLength: 0, value: nil, flags: 0) var rights = AuthorizationRights(count: 1, items: &item) AuthorizationCreate(&rights, nil, [.interactionAllowed, .extendRights, .preAuthorize], &auth) let prefs = SCPreferencesCreateWithAuthorization(nil, "MyApp" as CFString, nil, auth!)! SCPreferencesLock(prefs, true) // fails in the sandbox let vlan = SCVLANInterfaceCreate(prefs, physicalInterface, 100 as CFNumber) SCPreferencesCommitChanges(prefs) SCPreferencesApplyChanges(prefs) SCPreferencesUnlock(prefs) What we see on macOS 27: Without the sandbox, SCPreferencesLock on preferences created with SCPreferencesCreateWithAuthorization succeeds. With com.apple.security.app-sandbox, the same call fails with kSCStatusAccessError ("Permission denied"). Read-only calls work in the sandbox: SCVLANInterfaceCopyAll, ACVLANInterfaceCopyAvailablePhysicalInterfaces and SCNetworkInterfaceCopyAll all return the expected results. Our questions: Can a sandboxed Mac App Store app create or delete VLAN interfaces in any supported way, through SystemConfiguration or another API? If not, is there an entitlement we could request for this, similar to com.apple.vm.networking? Or is a privileged helper (SMAppService.daemon) the only way? As we understand it, the Mac App Store doesn't allow a privileged helper. Are VLAN interfaces (vlanN) meant to appear in VZBridgedNetworkInterface.networkInterfaces(update: it appears i create vlan interface using mac settings network settings) so a VM can be bridged to one? Does vmnet's bridged mode support them? If a VM is bridged to the physical Ethernet port and tags its own frames inside the guest, do the 802.1Q tags pass through the bridge unchanged? If creating VLANs isn't possible from the sandbox, our fallback is to list the existing VLANs and send users to System Settings › Network › Manage Virtual Interfaces. We'd like to confirm that before building it. Thanks!
5
0
156
4d
Can macOS sandbox-exec confine writes to a directory that doesn’t exist yet?
I’m evaluating an offline command-line tool launched from Terminal on macOS. The parent process creates an enclosing directory, then launches the tool through /usr/bin/sandbox-exec -p with an inline profile. The tool must create its own output directory, which is absent at launch. Can a macOS sandbox profile reliably enforce all of the following for that invocation? Allow reads of the tool’s interpreter, dependencies and input files. Deny network access and creation of child processes by the sandboxed tool. Allow the tool to create /path/to/work/proof/producer001 and write beneath it, while denying writes outside that directory, including writes through symlinks or other path aliases. The proposed profile denies file-write* globally and allows it only under a subpath rule for the output directory. Does that exception cover creation of the directory itself when only its parent exists? Does deny process-fork cover all child-process creation paths, including posix_spawn? Is there a supported way to inspect or validate the effective policy for an exact command and working directory before invoking it? If sandbox-exec is unsuitable for this use, is there a supported macOS mechanism for applying these restrictions to a command-line tool launched from Terminal? A documentation reference would be helpful.
1
0
111
4d
Supported quarantine preservation when copying files from an App Sandbox process
What supported public API and verification contract should a sandboxed macOS file manager use to preserve a copied file's quarantine/provenance metadata? We observe different results in App Sandbox versus Finder and an otherwise-matched non-sandbox diagnostic. We want to keep App Sandbox and all security protections enabled, not remove quarantine or invent undocumented flag masks. Environment: macOS 26.6.2 (25G83), Apple Silicon, local APFS. Optimized Foundation-only diagnostic, Apple Development signing, Hardened Runtime, launched directly as an executable. The sandbox variant has app-sandbox, user-selected read/write and app-scope bookmark entitlements. This is not a notarized distribution-build comparison. Reproduction: Use an existing regular JPEG with naturally present com.apple.quarantine metadata identifying Chrome, raw flags 0283 and a nonempty event field. Keep the original read-only. Record SHA-256, length, full raw extended attributes and fresh NSURL quarantinePropertiesKey observations. Keep access to a user-granted local test directory active. Copy to a new, absent destination in a fresh directory using each of these three arms: fclonefileat with CLONE_ACL | CLONE_NOFOLLOW_ANY | CLONE_RESOLVE_BENEATH (28). copyfile with COPYFILE_CLONE | COPYFILE_ACL; record COPYFILE_STATE_WAS_CLONED. FileManager.copyItem(at:to:). Observe source and destination without setting, removing or repairing metadata. Each arm waits at least 1.1 seconds before copying; the source quarantine timestamp is much older than call time. Repeat with fresh destinations. Also copy the same source through actual Finder Copy/Paste twice. Compare two signed variants made from the same compiled payload, with identical executable name, bundle ID, Development identity and Hardened Runtime. The only signed entitlement difference is app-sandbox=true versus its omission. The sandbox variant resolves the existing exact folder grant; the non-sandbox diagnostic uses that same fixed test directory directly. Results: Sandbox diagnostic: all six calls succeed and data hashes/lengths match. All six outputs change raw flags 0283 to 0082, agent Chrome to the diagnostic app, event field nonempty to empty, and timestamp. Public output lacks the source event identifier and adds LSQuarantineTypeSandboxed. Matched non-sandbox diagnostic: all six copies preserve the full observed raw quarantine record and public quarantine dictionary. copyfile reports WAS_CLONED=true in both contexts. Finder: both copies preserve the full observed raw quarantine record and public dictionary. Source bytes and declared preserved metadata remain unchanged. Other compared raw attributes, mode, flags, birth/modification times, owner/group and ACL match in these cases. We also reproduced timestamp-only differences with files naturally quarantined by the diagnostic itself. The foreign-agent control above shows that the difference is not limited to timestamp. The chosen source exposes no public origin/data URL, so their preservation is untested. We have not traced the responsible internal component, tested Gatekeeper effects, or established whether the transformation is security-equivalent. We do not claim the three APIs use independent implementations or that all possible public API combinations have been tested. Could you clarify: Is this transformation expected for copying from an App Sandbox process, or should we file it as a bug? What documented preservation behavior should a sandboxed file manager rely on? Is there a supported API or operation that preserves the source's quarantine/provenance metadata in this context without disabling App Sandbox or weakening security protections? If exact raw equality is intentionally not guaranteed, which supported public properties or behaviors should verification check? Is a quarantine-properties dictionary round-trip supported, and what information does it preserve or omit? We have not attempted a metadata repair. Separately, a pathname-based repair after cloning would require its own destination-identity/race safety review because the clone call does not return a creation-bound destination descriptor. We are asking for supported API semantics, not private implementation details or a security bypass. We can prepare a minimal sanitized standalone reproducer if needed. No user files, sandbox grants, private logs or diagnostic binaries are attached to this initial question.
5
0
634
4d
macOS 26.x App Sandbox: supported disk-image attachment and descriptor-based unmount
On macOS 26.x, is there a public, supported way for an App Sandbox application with com.apple.security.virtualization to attach a new disk-image file held in its own container and mount its APFS filesystem within that container, without root, privileged or unsandboxed helpers, private/temporary exception entitlements, Full Disk Access, or weakening App Sandbox? We distinguish attaching the image from mounting an already attached virtual device. DTS threads 655767, 780965 and 775835 discuss these separately. Which supported API or tool and entitlements apply on 26.x, if such a path exists? If attachment is supported, what ownership and sandbox checks apply to a later normal funmount(fd, 0) using an O_EVTONLY descriptor for that exact mount's root? Is this combination supported, including when another actor has already unmounted it? If not, what supported alternative preserves the same restricted profile and avoids force or whole-disk unmount?
0
0
93
6d
Sandboxed app can't delete AppleDouble (._) files of quarantined files on exFAT, even with user-selected access.
My Mac App Store utility removes Mac metadata files (._* AppleDouble files and .DS_Store) from external drives formatted exFAT or FAT32. The app is sandboxed with com.apple.security.files.user-selected.read-write and com.apple.security.files.bookmarks.app-scope. The user grants access to the volume through NSOpenPanel. Deleting a ._ file works, except when its companion file carries com.apple.quarantine (for example, a file downloaded with Safari and copied to the drive with Finder). Then: let partner = volume + "/Nirvana.zip" // has com.apple.quarantine let appleDouble = volume + "/._Nirvana.zip" removexattr(partner, "com.apple.quarantine", XATTR_NOFOLLOW) // -1, errno 1 (EPERM) unlink(appleDouble) // -1, errno 1 (EPERM)The same unlink succeeds from Terminal (not sandboxed, without Full Disk Access). On exFAT the extended attributes live in the ._ file, so I assume the sandbox refuses because deleting it would remove the quarantine attribute. Tried, with no change: Full Disk Access granted to the app. Adding com.apple.security.files.user-selected.executable (verified in the built app with codesign -d --entitlements -). On a real drive (a music library), about 71% of the ._ files belong to quarantined files, so this is most of what users want removed. Is there a supported way for a sandboxed app to remove these files: an entitlement, an API, or an explicit user action? If not, can you confirm it's intended behavior, so I can explain it accurately to users? macOS 27.2, Xcode 27.2, Apple silicon. Focused sample project available (one source file). DTS case 23240704.
5
0
174
1w
Supported read/write handoff of a sandbox-container PNG to Preview using NSWorkspace
Hello, I am preparing an existing macOS screenshot utility for distribution through the Mac App Store. The app stores captured PNG files under its temporary directory: FileManager.default.temporaryDirectory .appendingPathComponent("ShelfDragPoC/Captures", isDirectory: true) A context-menu "Edit" action passes the original PNG URL to Preview using NSWorkspace. The app does not create an editing copy. Relevant code: import AppKit @MainActor func openInPreview(_ url: URL) { guard let previewURL = NSWorkspace.shared.urlForApplication( withBundleIdentifier: "com.apple.Preview" ) else { return } let configuration = NSWorkspace.OpenConfiguration() configuration.activates = true NSWorkspace.shared.open( [url], withApplicationAt: previewURL, configuration: configuration ) { _, _ in } } The app monitors the original PNG URL for file changes and refreshes its thumbnail when changes are detected. Observed behavior: In the existing non-sandboxed app, rotating an image in Preview updates the original PNG and the thumbnail without requiring Command-S. In the sandboxed validation app, Preview opens the image, but editing results in a separate copy. When closing the edited document, Preview displays a message indicating that the original document will not be changed. The original PNG and the app's thumbnail are not updated. The Preview launch code and file watcher are unchanged between the non-sandboxed and sandboxed versions. The sandboxed app has these entitlements: com.apple.security.app-sandbox com.apple.security.files.user-selected.read-write com.apple.security.files.bookmarks.app-scope The app-scoped bookmark is used for a separate Desktop export feature. The PNG opened in Preview remains in the app's sandbox container. My question: Is there a supported public API that allows a sandboxed Mac App Store app to open its own container-resident PNG in Preview with the permissions required for in-place editing and normal automatic saving? Ideally, the user would only need to select "Edit" once, without an additional file-selection dialog or an explicit Save command. We want to preserve the original PNG URL, keep App Sandbox enabled, and avoid automatically exporting temporary images to the Desktop. If this workflow is not supported, what is Apple's recommended approach? Thank you.
13
0
530
1w
Is com.apple.security.device.serial supported for new Mac App Store updates?
I’m preparing an update to a native macOS serial logger already distributed through the Mac App Store. The app uses IOSerialBSDClient to enumerate serial ports, opens the selected /dev/cu.* device with open(O_RDWR | O_NOCTTY | O_NONBLOCK), and configures it with termios. On macOS 27.2, open() returns EPERM with App Sandbox enabled and the USB and Bluetooth entitlements present. The same port opens successfully from a process without App Sandbox. I reproduced this with several adapters. Apple’s archived Entitlement Key Reference lists com.apple.security.device.serial and describes adding it manually: https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html The macOS 27.2 App Sandbox profile still contains a rule for this entitlement, but I couldn’t find it in the current entitlement documentation or in Xcode 27.2’s Signing & Capabilities editor. Is adding com.apple.security.device.serial manually to the app’s signed entitlements still the supported approach for new Mac App Store updates? Does it require separate approval or provisioning authorization? If this entitlement is no longer supported for Mac App Store submissions, what does Apple recommend for accessing system-provided BSD serial ports with App Sandbox enabled? The app needs to work with ports exposed by both system and third-party drivers and configure them through termios. Would a temporary file access exception for /dev/ be appropriate for this use case?
1
0
156
1w
Supported sandbox approach for cross-app window positioning and resizing
I am developing a macOS window-management utility for a new Mac App Store submission, targeting macOS 13+ on Apple silicon and supported Intel Macs. Its core function is to move and resize windows belonging to other, unmodified applications, in response to explicit menu commands, registered keyboard shortcuts, or optional edge-drag snapping. The current unsandboxed engineering implementation uses public Accessibility APIs: AXUIElementCreateApplication, AXUIElementCopyAttributeValue / AXUIElementCopyMultipleAttributeValues for window geometry, AXUIElementCopyElementAtPosition for drag targeting, and AXUIElementSetAttributeValue for AXPosition and AXSize. It requires explicit Accessibility consent. Window information is processed locally; the app does not transmit it. I understand that App Review Guideline 2.4.5(i) requires App Sandbox and that “Protecting user data with App Sandbox” lists assistive Accessibility API use as incompatible. The DTS answer in thread 789663 also explains that sandboxed apps cannot use Accessibility APIs, while noting that some use cases have alternatives. For this specific cross-application positioning/resizing use case: Is there a currently supported public API or documented, requestable entitlement that permits it in a newly submitted sandboxed Mac App Store app? If a supported alternative exists, what API/architecture and minimum OS requirements apply, including any approval process? If there is no supported route, can you confirm that this functionality cannot currently be delivered within the described sandboxed Mac App Store constraints? I am seeking a supported architecture for controlling other apps’ windows. The unsandboxed tests establish functionality only; they do not establish sandbox compatibility or App Review eligibility. References: https://developer.apple.com/app-store/review/guidelines/#hardware-compatibility https://developer.apple.com/documentation/security/protecting-user-data-with-app-sandbox https://developer.apple.com/forums/thread/789663
5
0
191
1w
Supported quarantine-preservation contract for sandboxed file operations
Traverse is a sandboxed macOS file manager with user-selected read/write access. For an input already carrying the complete raw com.apple.quarantine value 0086;timestamp;agent;event, a fresh private copy may receive 0082 with the remaining fields equal. This asks about the input state, without claiming a verified creation recipe for the retained test file. Our security requirement is equality of the entire original raw value before and throughout the interval when the destination name is reachable, including interruption immediately after publication. Is there a documented, supported App Sandbox API or operation that guarantees this for (a) a same-volume, same-inode move from private staging to an absent user-selected name, (b) a new file or extracted ZIP member, and (c) native Trash followed by restoration? If so, what OS/volume/entitlement scope and exact guarantee apply, and can the raw flags and event field be preserved without removing or replacing an OS-assigned quarantine mark? If no such public contract exists, please confirm that raw byte equality cannot be claimed from quarantineProperties, FileManager.trashItem, NSWorkspace.recycle, NSFileCoordinator, rename, clone/copy, or post-operation readback alone. We are not requesting a bypass of quarantine or a weaker substitute for 0086.
1
0
88
1w
Using tcsetattr on stdin in sandboxed CLI app does not work due ioctl restriction
Our (sandboxed, distributed through the Mac App Store) app can optionally run as a CLI tool, to allow users to use it in scripts and other automation contexts. One of the usecases involves being a wrapper for the ssh command, but the ssh binary is not able to enable raw mode for stdin due to a sandbox violation (bug report). As a reduced example, I've created https://github.com/mihaip/sandboxed-cli-test, which has a minimal C program that uses tcsetattr to set attributes on stdin. That fails, and sandboxd logs to the console Sandbox: SandboxedCLI(30110) deny(1) file-ioctl /dev/ttys012. If I disable sandboxing on the binary then it works as expected. Looking through the sandbox profiles on /System/Library/Sandbox/Profiles, I'm not seeing cases where file-ioctl is enabled on /dev/tty. Are we out of luck, or is there a workaround?
1
5
1.6k
2w
Sandboxed app cannot place File Provider placeholder file URLs on the pasteboard (sandbox error -20)
I'm building a sandboxed macOS app (Developer ID, App Sandbox enabled) with a File Provider extension that exposes on-demand placeholder files under  ~/Library/CloudStorage/<domain>/ . Expected: The app writes the placeholder file URLs to  NSPasteboard.general . The user presses ⌘V in Finder, and Finder fetches the contents on demand via  fetchContents . Observed: • Finder's own copy and paste of the same placeholders works, and  fetchContents  is called at paste time as expected. • When the sandboxed app writes the URLs to the pasteboard,  CFPasteboard  logs:  Sandbox extension creation failed ... (error -20) . The paste does not happen. • Writing  NSPasteboardItem  with  .fileURL  strings instead of  NSURL  objects produces the same error. • Adding  com.apple.security.temporary-exception.files.absolute-path.read-only  for the CloudStorage domain path fixes it. Questions: Is there a supported way for a sandboxed app to put File Provider placeholder URLs on the pasteboard without the temporary-exception entitlement? Is the temporary-exception entitlement acceptable for Mac App Store distribution, or is it only viable for Developer ID builds? Should the app grant itself access another way, for example through a security-scoped bookmark or by using  NSFileProviderManager  APIs?
4
0
303
2w
Can a sandboxed macOS app manage other applications windows with user consent?
I'm planning to develop a macOS tiling window manager for potential distribution through the Mac App Store. Planned Features Detect application windows and observe focus changes. Move, resize, and focus windows belonging to other applications. Organize windows into app-defined virtual workspaces rather than native macOS Spaces. Display a separate workspace navigation bar without replacing or disabling the native macOS menu bar. Security and Permissions The application would: Use only public macOS APIs. Not load user-provided plugins. Not require root privileges. Request explicit Accessibility permission from users. Not replace or disable native macOS functionality. App Sandbox Considerations Apple's Protecting User Data with App Sandbox documentation lists "Use of accessibility APIs in assistive apps" as a restricted activity. Questions Sandbox restrictions: Does this restriction prevent a sandboxed application from managing windows belonging to other applications, even when the user explicitly grants Accessibility permission? Supported APIs and entitlements: Are there public macOS APIs or entitlements that allow these window management operations while remaining compliant with App Sandbox requirements? Mac App Store distribution: Is there an Apple-supported architecture or approach that would allow this functionality to be distributed through the Mac App Store? Goal I'd like to confirm the technical feasibility of implementing these features within Apple's App Sandbox and Mac App Store requirements before beginning development.
2
0
258
2w
Node.js aborts before JavaScript execution under sandbox-exec on macOS — LIBIGNITION termination code 2
I am investigating a startup failure when running Node.js under a restrictive sandbox-exec profile. I would appreciate guidance on diagnosing the failure and on a supported way to run a command-line process with restricted filesystem access and no network access. I have not established whether this is caused by my profile, the operating system, or another interaction. Environment macOS 26.6.2, build 25G83 Apple silicon, ARM64, without Rosetta Official Node.js 22.23.4 darwin-arm64 distribution; its archive SHA-256 matches the published checksum Python 3.14 launching the process from Terminal No sudo, application code, third-party JavaScript modules, credentials, or real user data The Node version above identifies the downloaded distribution. I have not confirmed a successful node --version execution in this restricted environment. Launch configuration The invocation has this form: /usr/bin/sandbox-exec -f <PROFILE> <NODE> -e <JS> <INPUT> <WORK>Python uses subprocess.Popen, with: Working directory set to <WORK> start_new_session=True Standard output and error captured through pipes A 10-second execution deadline and a 6-second termination/cleanup allowance Only these environment variables are supplied; the parent environment is not inherited: PATH=<NODE_DIR>:/usr/bin:/bin HOME=<WORK> TMPDIR=<WORK>NODE_OPTIONS and DYLD_* are not set. The JavaScript starts with: console.log("NODE_JS_ENTRY");It then uses node:fs to read a synthetic input and write markers in the permitted work directory. The initial console marker is never observed. Filesystem and network restrictions The profile uses (deny default) and (deny network*). It permits process creation, execution of the specified Node binary, and sysctl-read. File reads are allowed for the Node binary, synthetic input/work directories, /System/Library, /usr/lib, and the specific devices /dev/null, /dev/random, and /dev/urandom. Ancestor-directory metadata access is listed using individual literal paths. Writes are allowed only inside the work directory. The Node binary and synthetic fixtures are in separate dedicated directories under the user's Documents directory. This is a description of the profile, not a complete runnable reproduction. Paths are anonymized here. I tested two additional permission variants: A — ancestor metadata and existence checks: (allow file-read-metadata file-test-existence (literal "/System/Volumes") (literal "/System/Volumes/Preboot"))A+B — the above plus Cryptexes reads and executable mapping: (allow file-read* file-map-executable file-test-existence (subpath "/System/Volumes/Preboot/Cryptexes"))Neither variant resolved the startup failure. No general Mach/IPC permissions, broad /etc read access, localhost access, or system.sb import were added. Observed results The original profile and both variants terminated with SIGABRT, without the initial JavaScript marker. For A and A+B: Python reported child return code -6. Standard output and error were both empty. The parent sent no termination signal; these were not timeout terminations. The direct child was reaped, and its process group was no longer present. For two earlier executions using the original profile, I matched saved crash reports to the process and Node binary image. They showed: Exception: EXC_CRASH / SIGABRT Termination namespace: 0x23 Termination code: 2 Termination flags: 582The stack included: __abort_with_payload abort_with_payload_wrapper_internal abort_with_reason ignition_halt boot_boot ignite dyld4::CacheFinder::CacheFinder dyld4::ProcessConfig::DyldCache::DyldCache dyld4::ProcessConfig::ProcessConfig dyld4::start startApple's public XNU definitions identify namespace 35 as OS_REASON_LIBIGNITION. I have not established the meaning of code 2 for this OS build. I have not inspected matching crash stacks for A or A+B, so I cannot claim they stopped at the same internal location. Questions Is sandbox-exec a supported mechanism for this use case on this macOS version? If not, what supported approach can enforce both restricted filesystem access and no network access for a command-line process and its children? What diagnostic information would distinguish a missing sandbox permission from a loader/cache initialization problem? Does this termination signature suggest a documented diagnostic procedure or known issue? My goal is to reach JavaScript execution while preserving the restrictions, rather than broadly allowing filesystem access or network communication. I can provide a sanitized profile and relevant diagnostic excerpts if needed. Thank you. Correction and update after checking the saved crash reports: The original-profile runs were on macOS 26.6.2 (25G83), while the A and A+B runs were on macOS 26.7.2 (25G332). My initial post did not distinguish these environments correctly. The saved reports for A and A+B have now been matched to the recorded execution times, process IDs, and Node image information. Both show SIGABRT, termination namespace 0x23, code 2, and the same 11-frame sequence of function names and offsets as the original-profile reports, including ignite, boot_boot, and ignition_halt. The Node image UUID is unchanged, but the OS version and dyld image identifiers differ. These results therefore must not be treated as a controlled comparison in which only the sandbox profile changed. The matching termination signatures do not establish an identical root cause. The specific reason for LIBIGNITION code 2 remains unknown. No additional executions or permission changes have been performed.
1
0
225
2w
Supported macOS containment for a sandboxed worker after controller failure.
Subject: Supported macOS containment for a sandboxed worker after controller failure I'm investigating an Apple Silicon/macOS architecture in which an untrusted, signed, sandboxed worker must be independently containable by a separate trusted supervisor. The worker needs only a narrow authenticated communication channel. It requires no direct network access, external operational credentials, privileged file access or authority to launch helpers. I understand that App Sandbox does not inherently prevent child-process creation, and that RLIMIT_NPROC alone does not prevent every form of execution delegation. Could you clarify: Is there a public, supported macOS mechanism to deny all worker-originated subprocess creation and execution delegation at launch, while retaining one restricted communication channel? Alternatively, is there a supported mechanism for a surviving supervisor to identify, terminate and positively verify the complete execution domain of a worker, including any descendants, after its controller crashes or is suspended? What guarantees and limitations apply to stable identity, process exit, automatic relaunch and loss of the supervisor? I'm specifically seeking supported operating-system guarantees, not private sandbox profiles, polling, heartbeat inference or best-effort process-tree enumeration. The goal is to determine whether a bounded synthetic containment experiment is technically justified. No production implementation has been attempted.
5
0
207
3w
Title: Supported OS-enforced restriction of Keychain access while retaining App Sandbox and App Group UDS
I’m designing a small, controlled macOS test harness. Two separately signed, sandboxed applications communicate through a UNIX-domain socket in an App Group container. They run as non-root processes in a GUI user session. One application also launches a child that inherits its sandbox and an existing socket descriptor. Is there a documented, supported OS policy that preserves this IPC arrangement while preventing the test processes from retrieving, using or modifying credentials, including items in their own Data Protection Keychain access groups and reachable file-based keychains? The policy must also prevent creating credential stores/items outside the permitted test resources. Using a macOS-style TeamID-prefixed App Group avoids that group providing Keychain sharing, but does not establish denial of the remaining Keychain operations. Empty stores, avoiding API calls and relying on users refusing prompts are insufficient for this requirement. If a different execution context or isolation architecture is required, could you identify the supported mechanism and relevant documentation? I’m seeking platform guidance, without relying on private APIs or unsupported custom sandbox profiles.
3
0
349
3w
App Sandbox Resources
General: Forums subtopic: Privacy & Security > General Forums 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 forums post) Resolving App Sandbox Inheritance Problems forums post The Case for Sandboxing a Directly Distributed App forums post Implementing Script Attachment in a Sandboxed App forums 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.
Replies
0
Boosts
0
Views
3.7k
Activity
Jul ’25
Launching a signed AppKit app from a Python supervisor while preserving instance ownership and bounded cleanup
I'm looking for a supported way to launch a signed AppKit application for user interaction from a local Python supervisor, while retaining reliable supervision of the exact launched instance. Environment Apple M3 MacBook Air, macOS 14.5, build 23F79. arm64 app built with Command Line Tools clang and the macOS 14.5 SDK, targeting macOS 14.0. AppKit/Foundation with embedded CPython 3.12. Apple Development signing, hardened runtime and strict signature checks passed. Current launch and activation sequence The supervisor directly launches the bundle executable with Popen: a fixed argument, empty environment, new process session, disconnected stdin, and an anonymous stdout pipe carrying fixed, nonsecret startup markers. There is no LaunchServices foreground handoff. On its main thread, the app initializes NSApplication, confirms Regular activation policy, calls finishLaunching and activateIgnoringOtherApps:YES, then waits for isActive. Event-retrieval waits are capped at 20 ms; event dispatch itself may take longer. Existing timeout supervision remains active. Our activation guard is two seconds from the readiness routine's start, subject to the remaining native timer. A separate overall test budget is 300 seconds from operator readiness, before preflight. Observed result The latest test exited with code 1 after approximately 2.57 seconds. The validated markers were: absence.begin → absence.absent → fields.begin → ui.begin → app.shared.begin → app.shared.ready → policy.before → policy.already_regular → policy.postcondition → launch.finish.begin → launch.finish.ready → activation.requested → activation.wait.begin → stop.activation.timeoutThe final recorded state was: main=1 app=1 active=0 policy=0 window=0 visible=-1 key=-1The app stopped before constructing the dialog. Adding event processing did not resolve activation. We have not established why activation failed or which events were delivered. The two-second deadline is our guard, not an asserted macOS activation guarantee. Questions What supported launch and activation approach should this supervisor use for a foreground, interactive AppKit app? Can this direct-executable design be corrected narrowly, or should launching move to LaunchServices with a different communication and supervision arrangement? With the recommended approach, how should the supervisor identify the exact launched instance, receive startup status, enforce bounded termination, and establish that the process has exited before cleanup? We reviewed a simple foreground-launch substitution, but it did not preserve our existing marker pipe and authoritative exit/reap evidence. That is a limitation of our proposed adaptation, not a claim that Apple's APIs cannot support these outcomes. The essential requirements are exact-instance identification, nonsecret status reporting, bounded termination and verified cleanup. An anonymous pipe and direct-child waiting are current implementation choices, not requirements in themselves.
Replies
6
Boosts
0
Views
134
Activity
1d
Supported termination of a specific unresponsive embedded XPC service instance
We are evaluating a signed macOS launcher app with an embedded XPC service. The service would own a VZVirtualMachine. Before permitting VM startup, the launcher must bind the admitted job to the actual service instance and establish any required termination authority. We need clarification on the following: Is there a public, supported mechanism for the containing app to terminate that specific service instance if it becomes unresponsive, including before its first application-level reply? If so, what API, signing, sandbox, entitlement, and authorization conditions apply? How can the termination target remain bound to that instance despite PID reuse or service regeneration? Is transfer of a task-control right from the service to the launcher, followed by task_terminate, supported for this purpose? If it requires the service to respond first, is there a supported alternative for a pre-reply hang? What supported observation confirms termination of that same process instance, separately from acceptance of a termination request? What lifecycle behavior applies if the containing launcher itself terminates unexpectedly? We understand from threads 848542 and 850709 that Virtualization is expected to reclaim a guest after its owner exits, but provides neither a teardown timeline guarantee nor a successor-process guest-completion handle. We are not requesting such a guarantee or treating service exit as proof of completed VM reclamation. Please identify applicable documentation and any platform-version restrictions.
Replies
2
Boosts
0
Views
77
Activity
1d
Access to related files outside Sandbox with NSFileCoordinator and NSFilePresenter does not work anymore in macOS 27.3 beta 2
In macOS 27.3 beta 2, it is no longer possible to use NSFileCoordinator with NSFilePresenter instances to open a SQLite file with related WAL and SHM files when a sandboxed app has access to the primary SQLite file. In macOS 27.3 beta 1 and previous macOS releases, the Related File Access API works as expected. This happens regardless where the files are located, so it seems to be unrelated to recent changes in Privacy & Security, although it could be an unexpected side effect of these changes. Instead of correctly registering NSFilePresenter instances, errors like the following are logged in the XCode console: NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for /Users/testuser/Desktop/Sample/Example.sqlite-wal because: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (The related item is protected by a different storage class than the primary item) UserInfo={NSDebugDescription=The related item is protected by a different storage class than the primary item} +[NSFileCoordinator addFilePresenter:] could not get a sandbox extension. primaryPresentedItemURL: file:///Users/testuser/Desktop/Sample/Example.sqlite, presentedItemURL: file:///Users/testuser/Desktop/Sample/Example.sqlite-walThe mentioned Related File Access API is documented here. I have filed a Feedback, which includes a sample project: FB25625743 My question is: Is this a bug, or new intended behavior, or is there something else changed that should be dealed with when using this API in macOS 27.3 beta 2?
Replies
1
Boosts
0
Views
70
Activity
3d
Can macOS verify a worker’s effective sandbox policy before it runs?
I’m building a local app on an Apple silicon Mac. Before a worker or any of its child processes can run, I need to verify the worker’s effective filesystem and network restrictions, including inherited restrictions. I need to allow that same pending launch only if the policy matches, and deny it if verification fails or times out. I reviewed Apple’s App Sandbox guidance and the Endpoint Security documentation for exec authorization and entitlement metadata. I haven’t found documentation showing that these expose the complete effective policy for the pending launch. Is there a supported public macOS API that provides this guarantee? If so, which API and macOS versions support it? If not, is this outside what the public APIs can verify?
Replies
1
Boosts
0
Views
201
Activity
3d
Can a Mac App Store (sandboxed) app create and delete VLAN interfaces with SCVLANInterfaceCreate?
We make a Mac App Store app that runs virtual machines with the Virtualization framework. It has the com.apple.vm.networking entitlement and already bridges VMs to physical interfaces through VZBridgedNetworkDeviceAttachment. We'd like users to manage 802.1Q VLAN interfaces from inside the app, so they can create a VLAN on an Ethernet port and bridge a VM to it. The SystemConfiguration API for this is: var auth: AuthorizationRef? var item = AuthorizationItem(name: "system.services.systemconfiguration.network", valueLength: 0, value: nil, flags: 0) var rights = AuthorizationRights(count: 1, items: &item) AuthorizationCreate(&rights, nil, [.interactionAllowed, .extendRights, .preAuthorize], &auth) let prefs = SCPreferencesCreateWithAuthorization(nil, "MyApp" as CFString, nil, auth!)! SCPreferencesLock(prefs, true) // fails in the sandbox let vlan = SCVLANInterfaceCreate(prefs, physicalInterface, 100 as CFNumber) SCPreferencesCommitChanges(prefs) SCPreferencesApplyChanges(prefs) SCPreferencesUnlock(prefs) What we see on macOS 27: Without the sandbox, SCPreferencesLock on preferences created with SCPreferencesCreateWithAuthorization succeeds. With com.apple.security.app-sandbox, the same call fails with kSCStatusAccessError ("Permission denied"). Read-only calls work in the sandbox: SCVLANInterfaceCopyAll, ACVLANInterfaceCopyAvailablePhysicalInterfaces and SCNetworkInterfaceCopyAll all return the expected results. Our questions: Can a sandboxed Mac App Store app create or delete VLAN interfaces in any supported way, through SystemConfiguration or another API? If not, is there an entitlement we could request for this, similar to com.apple.vm.networking? Or is a privileged helper (SMAppService.daemon) the only way? As we understand it, the Mac App Store doesn't allow a privileged helper. Are VLAN interfaces (vlanN) meant to appear in VZBridgedNetworkInterface.networkInterfaces(update: it appears i create vlan interface using mac settings network settings) so a VM can be bridged to one? Does vmnet's bridged mode support them? If a VM is bridged to the physical Ethernet port and tags its own frames inside the guest, do the 802.1Q tags pass through the bridge unchanged? If creating VLANs isn't possible from the sandbox, our fallback is to list the existing VLANs and send users to System Settings › Network › Manage Virtual Interfaces. We'd like to confirm that before building it. Thanks!
Replies
5
Boosts
0
Views
156
Activity
4d
Can macOS sandbox-exec confine writes to a directory that doesn’t exist yet?
I’m evaluating an offline command-line tool launched from Terminal on macOS. The parent process creates an enclosing directory, then launches the tool through /usr/bin/sandbox-exec -p with an inline profile. The tool must create its own output directory, which is absent at launch. Can a macOS sandbox profile reliably enforce all of the following for that invocation? Allow reads of the tool’s interpreter, dependencies and input files. Deny network access and creation of child processes by the sandboxed tool. Allow the tool to create /path/to/work/proof/producer001 and write beneath it, while denying writes outside that directory, including writes through symlinks or other path aliases. The proposed profile denies file-write* globally and allows it only under a subpath rule for the output directory. Does that exception cover creation of the directory itself when only its parent exists? Does deny process-fork cover all child-process creation paths, including posix_spawn? Is there a supported way to inspect or validate the effective policy for an exact command and working directory before invoking it? If sandbox-exec is unsuitable for this use, is there a supported macOS mechanism for applying these restrictions to a command-line tool launched from Terminal? A documentation reference would be helpful.
Replies
1
Boosts
0
Views
111
Activity
4d
Supported quarantine preservation when copying files from an App Sandbox process
What supported public API and verification contract should a sandboxed macOS file manager use to preserve a copied file's quarantine/provenance metadata? We observe different results in App Sandbox versus Finder and an otherwise-matched non-sandbox diagnostic. We want to keep App Sandbox and all security protections enabled, not remove quarantine or invent undocumented flag masks. Environment: macOS 26.6.2 (25G83), Apple Silicon, local APFS. Optimized Foundation-only diagnostic, Apple Development signing, Hardened Runtime, launched directly as an executable. The sandbox variant has app-sandbox, user-selected read/write and app-scope bookmark entitlements. This is not a notarized distribution-build comparison. Reproduction: Use an existing regular JPEG with naturally present com.apple.quarantine metadata identifying Chrome, raw flags 0283 and a nonempty event field. Keep the original read-only. Record SHA-256, length, full raw extended attributes and fresh NSURL quarantinePropertiesKey observations. Keep access to a user-granted local test directory active. Copy to a new, absent destination in a fresh directory using each of these three arms: fclonefileat with CLONE_ACL | CLONE_NOFOLLOW_ANY | CLONE_RESOLVE_BENEATH (28). copyfile with COPYFILE_CLONE | COPYFILE_ACL; record COPYFILE_STATE_WAS_CLONED. FileManager.copyItem(at:to:). Observe source and destination without setting, removing or repairing metadata. Each arm waits at least 1.1 seconds before copying; the source quarantine timestamp is much older than call time. Repeat with fresh destinations. Also copy the same source through actual Finder Copy/Paste twice. Compare two signed variants made from the same compiled payload, with identical executable name, bundle ID, Development identity and Hardened Runtime. The only signed entitlement difference is app-sandbox=true versus its omission. The sandbox variant resolves the existing exact folder grant; the non-sandbox diagnostic uses that same fixed test directory directly. Results: Sandbox diagnostic: all six calls succeed and data hashes/lengths match. All six outputs change raw flags 0283 to 0082, agent Chrome to the diagnostic app, event field nonempty to empty, and timestamp. Public output lacks the source event identifier and adds LSQuarantineTypeSandboxed. Matched non-sandbox diagnostic: all six copies preserve the full observed raw quarantine record and public quarantine dictionary. copyfile reports WAS_CLONED=true in both contexts. Finder: both copies preserve the full observed raw quarantine record and public dictionary. Source bytes and declared preserved metadata remain unchanged. Other compared raw attributes, mode, flags, birth/modification times, owner/group and ACL match in these cases. We also reproduced timestamp-only differences with files naturally quarantined by the diagnostic itself. The foreign-agent control above shows that the difference is not limited to timestamp. The chosen source exposes no public origin/data URL, so their preservation is untested. We have not traced the responsible internal component, tested Gatekeeper effects, or established whether the transformation is security-equivalent. We do not claim the three APIs use independent implementations or that all possible public API combinations have been tested. Could you clarify: Is this transformation expected for copying from an App Sandbox process, or should we file it as a bug? What documented preservation behavior should a sandboxed file manager rely on? Is there a supported API or operation that preserves the source's quarantine/provenance metadata in this context without disabling App Sandbox or weakening security protections? If exact raw equality is intentionally not guaranteed, which supported public properties or behaviors should verification check? Is a quarantine-properties dictionary round-trip supported, and what information does it preserve or omit? We have not attempted a metadata repair. Separately, a pathname-based repair after cloning would require its own destination-identity/race safety review because the clone call does not return a creation-bound destination descriptor. We are asking for supported API semantics, not private implementation details or a security bypass. We can prepare a minimal sanitized standalone reproducer if needed. No user files, sandbox grants, private logs or diagnostic binaries are attached to this initial question.
Replies
5
Boosts
0
Views
634
Activity
4d
macOS 26.x App Sandbox: supported disk-image attachment and descriptor-based unmount
On macOS 26.x, is there a public, supported way for an App Sandbox application with com.apple.security.virtualization to attach a new disk-image file held in its own container and mount its APFS filesystem within that container, without root, privileged or unsandboxed helpers, private/temporary exception entitlements, Full Disk Access, or weakening App Sandbox? We distinguish attaching the image from mounting an already attached virtual device. DTS threads 655767, 780965 and 775835 discuss these separately. Which supported API or tool and entitlements apply on 26.x, if such a path exists? If attachment is supported, what ownership and sandbox checks apply to a later normal funmount(fd, 0) using an O_EVTONLY descriptor for that exact mount's root? Is this combination supported, including when another actor has already unmounted it? If not, what supported alternative preserves the same restricted profile and avoids force or whole-disk unmount?
Replies
0
Boosts
0
Views
93
Activity
6d
Sandboxed app can't delete AppleDouble (._) files of quarantined files on exFAT, even with user-selected access.
My Mac App Store utility removes Mac metadata files (._* AppleDouble files and .DS_Store) from external drives formatted exFAT or FAT32. The app is sandboxed with com.apple.security.files.user-selected.read-write and com.apple.security.files.bookmarks.app-scope. The user grants access to the volume through NSOpenPanel. Deleting a ._ file works, except when its companion file carries com.apple.quarantine (for example, a file downloaded with Safari and copied to the drive with Finder). Then: let partner = volume + "/Nirvana.zip" // has com.apple.quarantine let appleDouble = volume + "/._Nirvana.zip" removexattr(partner, "com.apple.quarantine", XATTR_NOFOLLOW) // -1, errno 1 (EPERM) unlink(appleDouble) // -1, errno 1 (EPERM)The same unlink succeeds from Terminal (not sandboxed, without Full Disk Access). On exFAT the extended attributes live in the ._ file, so I assume the sandbox refuses because deleting it would remove the quarantine attribute. Tried, with no change: Full Disk Access granted to the app. Adding com.apple.security.files.user-selected.executable (verified in the built app with codesign -d --entitlements -). On a real drive (a music library), about 71% of the ._ files belong to quarantined files, so this is most of what users want removed. Is there a supported way for a sandboxed app to remove these files: an entitlement, an API, or an explicit user action? If not, can you confirm it's intended behavior, so I can explain it accurately to users? macOS 27.2, Xcode 27.2, Apple silicon. Focused sample project available (one source file). DTS case 23240704.
Replies
5
Boosts
0
Views
174
Activity
1w
Supported read/write handoff of a sandbox-container PNG to Preview using NSWorkspace
Hello, I am preparing an existing macOS screenshot utility for distribution through the Mac App Store. The app stores captured PNG files under its temporary directory: FileManager.default.temporaryDirectory .appendingPathComponent("ShelfDragPoC/Captures", isDirectory: true) A context-menu "Edit" action passes the original PNG URL to Preview using NSWorkspace. The app does not create an editing copy. Relevant code: import AppKit @MainActor func openInPreview(_ url: URL) { guard let previewURL = NSWorkspace.shared.urlForApplication( withBundleIdentifier: "com.apple.Preview" ) else { return } let configuration = NSWorkspace.OpenConfiguration() configuration.activates = true NSWorkspace.shared.open( [url], withApplicationAt: previewURL, configuration: configuration ) { _, _ in } } The app monitors the original PNG URL for file changes and refreshes its thumbnail when changes are detected. Observed behavior: In the existing non-sandboxed app, rotating an image in Preview updates the original PNG and the thumbnail without requiring Command-S. In the sandboxed validation app, Preview opens the image, but editing results in a separate copy. When closing the edited document, Preview displays a message indicating that the original document will not be changed. The original PNG and the app's thumbnail are not updated. The Preview launch code and file watcher are unchanged between the non-sandboxed and sandboxed versions. The sandboxed app has these entitlements: com.apple.security.app-sandbox com.apple.security.files.user-selected.read-write com.apple.security.files.bookmarks.app-scope The app-scoped bookmark is used for a separate Desktop export feature. The PNG opened in Preview remains in the app's sandbox container. My question: Is there a supported public API that allows a sandboxed Mac App Store app to open its own container-resident PNG in Preview with the permissions required for in-place editing and normal automatic saving? Ideally, the user would only need to select "Edit" once, without an additional file-selection dialog or an explicit Save command. We want to preserve the original PNG URL, keep App Sandbox enabled, and avoid automatically exporting temporary images to the Desktop. If this workflow is not supported, what is Apple's recommended approach? Thank you.
Replies
13
Boosts
0
Views
530
Activity
1w
Is com.apple.security.device.serial supported for new Mac App Store updates?
I’m preparing an update to a native macOS serial logger already distributed through the Mac App Store. The app uses IOSerialBSDClient to enumerate serial ports, opens the selected /dev/cu.* device with open(O_RDWR | O_NOCTTY | O_NONBLOCK), and configures it with termios. On macOS 27.2, open() returns EPERM with App Sandbox enabled and the USB and Bluetooth entitlements present. The same port opens successfully from a process without App Sandbox. I reproduced this with several adapters. Apple’s archived Entitlement Key Reference lists com.apple.security.device.serial and describes adding it manually: https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html The macOS 27.2 App Sandbox profile still contains a rule for this entitlement, but I couldn’t find it in the current entitlement documentation or in Xcode 27.2’s Signing & Capabilities editor. Is adding com.apple.security.device.serial manually to the app’s signed entitlements still the supported approach for new Mac App Store updates? Does it require separate approval or provisioning authorization? If this entitlement is no longer supported for Mac App Store submissions, what does Apple recommend for accessing system-provided BSD serial ports with App Sandbox enabled? The app needs to work with ports exposed by both system and third-party drivers and configure them through termios. Would a temporary file access exception for /dev/ be appropriate for this use case?
Replies
1
Boosts
0
Views
156
Activity
1w
Supported sandbox approach for cross-app window positioning and resizing
I am developing a macOS window-management utility for a new Mac App Store submission, targeting macOS 13+ on Apple silicon and supported Intel Macs. Its core function is to move and resize windows belonging to other, unmodified applications, in response to explicit menu commands, registered keyboard shortcuts, or optional edge-drag snapping. The current unsandboxed engineering implementation uses public Accessibility APIs: AXUIElementCreateApplication, AXUIElementCopyAttributeValue / AXUIElementCopyMultipleAttributeValues for window geometry, AXUIElementCopyElementAtPosition for drag targeting, and AXUIElementSetAttributeValue for AXPosition and AXSize. It requires explicit Accessibility consent. Window information is processed locally; the app does not transmit it. I understand that App Review Guideline 2.4.5(i) requires App Sandbox and that “Protecting user data with App Sandbox” lists assistive Accessibility API use as incompatible. The DTS answer in thread 789663 also explains that sandboxed apps cannot use Accessibility APIs, while noting that some use cases have alternatives. For this specific cross-application positioning/resizing use case: Is there a currently supported public API or documented, requestable entitlement that permits it in a newly submitted sandboxed Mac App Store app? If a supported alternative exists, what API/architecture and minimum OS requirements apply, including any approval process? If there is no supported route, can you confirm that this functionality cannot currently be delivered within the described sandboxed Mac App Store constraints? I am seeking a supported architecture for controlling other apps’ windows. The unsandboxed tests establish functionality only; they do not establish sandbox compatibility or App Review eligibility. References: https://developer.apple.com/app-store/review/guidelines/#hardware-compatibility https://developer.apple.com/documentation/security/protecting-user-data-with-app-sandbox https://developer.apple.com/forums/thread/789663
Replies
5
Boosts
0
Views
191
Activity
1w
Supported quarantine-preservation contract for sandboxed file operations
Traverse is a sandboxed macOS file manager with user-selected read/write access. For an input already carrying the complete raw com.apple.quarantine value 0086;timestamp;agent;event, a fresh private copy may receive 0082 with the remaining fields equal. This asks about the input state, without claiming a verified creation recipe for the retained test file. Our security requirement is equality of the entire original raw value before and throughout the interval when the destination name is reachable, including interruption immediately after publication. Is there a documented, supported App Sandbox API or operation that guarantees this for (a) a same-volume, same-inode move from private staging to an absent user-selected name, (b) a new file or extracted ZIP member, and (c) native Trash followed by restoration? If so, what OS/volume/entitlement scope and exact guarantee apply, and can the raw flags and event field be preserved without removing or replacing an OS-assigned quarantine mark? If no such public contract exists, please confirm that raw byte equality cannot be claimed from quarantineProperties, FileManager.trashItem, NSWorkspace.recycle, NSFileCoordinator, rename, clone/copy, or post-operation readback alone. We are not requesting a bypass of quarantine or a weaker substitute for 0086.
Replies
1
Boosts
0
Views
88
Activity
1w
Using tcsetattr on stdin in sandboxed CLI app does not work due ioctl restriction
Our (sandboxed, distributed through the Mac App Store) app can optionally run as a CLI tool, to allow users to use it in scripts and other automation contexts. One of the usecases involves being a wrapper for the ssh command, but the ssh binary is not able to enable raw mode for stdin due to a sandbox violation (bug report). As a reduced example, I've created https://github.com/mihaip/sandboxed-cli-test, which has a minimal C program that uses tcsetattr to set attributes on stdin. That fails, and sandboxd logs to the console Sandbox: SandboxedCLI(30110) deny(1) file-ioctl /dev/ttys012. If I disable sandboxing on the binary then it works as expected. Looking through the sandbox profiles on /System/Library/Sandbox/Profiles, I'm not seeing cases where file-ioctl is enabled on /dev/tty. Are we out of luck, or is there a workaround?
Replies
1
Boosts
5
Views
1.6k
Activity
2w
Sandboxed app cannot place File Provider placeholder file URLs on the pasteboard (sandbox error -20)
I'm building a sandboxed macOS app (Developer ID, App Sandbox enabled) with a File Provider extension that exposes on-demand placeholder files under  ~/Library/CloudStorage/<domain>/ . Expected: The app writes the placeholder file URLs to  NSPasteboard.general . The user presses ⌘V in Finder, and Finder fetches the contents on demand via  fetchContents . Observed: • Finder's own copy and paste of the same placeholders works, and  fetchContents  is called at paste time as expected. • When the sandboxed app writes the URLs to the pasteboard,  CFPasteboard  logs:  Sandbox extension creation failed ... (error -20) . The paste does not happen. • Writing  NSPasteboardItem  with  .fileURL  strings instead of  NSURL  objects produces the same error. • Adding  com.apple.security.temporary-exception.files.absolute-path.read-only  for the CloudStorage domain path fixes it. Questions: Is there a supported way for a sandboxed app to put File Provider placeholder URLs on the pasteboard without the temporary-exception entitlement? Is the temporary-exception entitlement acceptable for Mac App Store distribution, or is it only viable for Developer ID builds? Should the app grant itself access another way, for example through a security-scoped bookmark or by using  NSFileProviderManager  APIs?
Replies
4
Boosts
0
Views
303
Activity
2w
Can a sandboxed macOS app manage other applications windows with user consent?
I'm planning to develop a macOS tiling window manager for potential distribution through the Mac App Store. Planned Features Detect application windows and observe focus changes. Move, resize, and focus windows belonging to other applications. Organize windows into app-defined virtual workspaces rather than native macOS Spaces. Display a separate workspace navigation bar without replacing or disabling the native macOS menu bar. Security and Permissions The application would: Use only public macOS APIs. Not load user-provided plugins. Not require root privileges. Request explicit Accessibility permission from users. Not replace or disable native macOS functionality. App Sandbox Considerations Apple's Protecting User Data with App Sandbox documentation lists "Use of accessibility APIs in assistive apps" as a restricted activity. Questions Sandbox restrictions: Does this restriction prevent a sandboxed application from managing windows belonging to other applications, even when the user explicitly grants Accessibility permission? Supported APIs and entitlements: Are there public macOS APIs or entitlements that allow these window management operations while remaining compliant with App Sandbox requirements? Mac App Store distribution: Is there an Apple-supported architecture or approach that would allow this functionality to be distributed through the Mac App Store? Goal I'd like to confirm the technical feasibility of implementing these features within Apple's App Sandbox and Mac App Store requirements before beginning development.
Replies
2
Boosts
0
Views
258
Activity
2w
Node.js aborts before JavaScript execution under sandbox-exec on macOS — LIBIGNITION termination code 2
I am investigating a startup failure when running Node.js under a restrictive sandbox-exec profile. I would appreciate guidance on diagnosing the failure and on a supported way to run a command-line process with restricted filesystem access and no network access. I have not established whether this is caused by my profile, the operating system, or another interaction. Environment macOS 26.6.2, build 25G83 Apple silicon, ARM64, without Rosetta Official Node.js 22.23.4 darwin-arm64 distribution; its archive SHA-256 matches the published checksum Python 3.14 launching the process from Terminal No sudo, application code, third-party JavaScript modules, credentials, or real user data The Node version above identifies the downloaded distribution. I have not confirmed a successful node --version execution in this restricted environment. Launch configuration The invocation has this form: /usr/bin/sandbox-exec -f <PROFILE> <NODE> -e <JS> <INPUT> <WORK>Python uses subprocess.Popen, with: Working directory set to <WORK> start_new_session=True Standard output and error captured through pipes A 10-second execution deadline and a 6-second termination/cleanup allowance Only these environment variables are supplied; the parent environment is not inherited: PATH=<NODE_DIR>:/usr/bin:/bin HOME=<WORK> TMPDIR=<WORK>NODE_OPTIONS and DYLD_* are not set. The JavaScript starts with: console.log("NODE_JS_ENTRY");It then uses node:fs to read a synthetic input and write markers in the permitted work directory. The initial console marker is never observed. Filesystem and network restrictions The profile uses (deny default) and (deny network*). It permits process creation, execution of the specified Node binary, and sysctl-read. File reads are allowed for the Node binary, synthetic input/work directories, /System/Library, /usr/lib, and the specific devices /dev/null, /dev/random, and /dev/urandom. Ancestor-directory metadata access is listed using individual literal paths. Writes are allowed only inside the work directory. The Node binary and synthetic fixtures are in separate dedicated directories under the user's Documents directory. This is a description of the profile, not a complete runnable reproduction. Paths are anonymized here. I tested two additional permission variants: A — ancestor metadata and existence checks: (allow file-read-metadata file-test-existence (literal "/System/Volumes") (literal "/System/Volumes/Preboot"))A+B — the above plus Cryptexes reads and executable mapping: (allow file-read* file-map-executable file-test-existence (subpath "/System/Volumes/Preboot/Cryptexes"))Neither variant resolved the startup failure. No general Mach/IPC permissions, broad /etc read access, localhost access, or system.sb import were added. Observed results The original profile and both variants terminated with SIGABRT, without the initial JavaScript marker. For A and A+B: Python reported child return code -6. Standard output and error were both empty. The parent sent no termination signal; these were not timeout terminations. The direct child was reaped, and its process group was no longer present. For two earlier executions using the original profile, I matched saved crash reports to the process and Node binary image. They showed: Exception: EXC_CRASH / SIGABRT Termination namespace: 0x23 Termination code: 2 Termination flags: 582The stack included: __abort_with_payload abort_with_payload_wrapper_internal abort_with_reason ignition_halt boot_boot ignite dyld4::CacheFinder::CacheFinder dyld4::ProcessConfig::DyldCache::DyldCache dyld4::ProcessConfig::ProcessConfig dyld4::start startApple's public XNU definitions identify namespace 35 as OS_REASON_LIBIGNITION. I have not established the meaning of code 2 for this OS build. I have not inspected matching crash stacks for A or A+B, so I cannot claim they stopped at the same internal location. Questions Is sandbox-exec a supported mechanism for this use case on this macOS version? If not, what supported approach can enforce both restricted filesystem access and no network access for a command-line process and its children? What diagnostic information would distinguish a missing sandbox permission from a loader/cache initialization problem? Does this termination signature suggest a documented diagnostic procedure or known issue? My goal is to reach JavaScript execution while preserving the restrictions, rather than broadly allowing filesystem access or network communication. I can provide a sanitized profile and relevant diagnostic excerpts if needed. Thank you. Correction and update after checking the saved crash reports: The original-profile runs were on macOS 26.6.2 (25G83), while the A and A+B runs were on macOS 26.7.2 (25G332). My initial post did not distinguish these environments correctly. The saved reports for A and A+B have now been matched to the recorded execution times, process IDs, and Node image information. Both show SIGABRT, termination namespace 0x23, code 2, and the same 11-frame sequence of function names and offsets as the original-profile reports, including ignite, boot_boot, and ignition_halt. The Node image UUID is unchanged, but the OS version and dyld image identifiers differ. These results therefore must not be treated as a controlled comparison in which only the sandbox profile changed. The matching termination signatures do not establish an identical root cause. The specific reason for LIBIGNITION code 2 remains unknown. No additional executions or permission changes have been performed.
Replies
1
Boosts
0
Views
225
Activity
2w
Supported macOS containment for a sandboxed worker after controller failure.
Subject: Supported macOS containment for a sandboxed worker after controller failure I'm investigating an Apple Silicon/macOS architecture in which an untrusted, signed, sandboxed worker must be independently containable by a separate trusted supervisor. The worker needs only a narrow authenticated communication channel. It requires no direct network access, external operational credentials, privileged file access or authority to launch helpers. I understand that App Sandbox does not inherently prevent child-process creation, and that RLIMIT_NPROC alone does not prevent every form of execution delegation. Could you clarify: Is there a public, supported macOS mechanism to deny all worker-originated subprocess creation and execution delegation at launch, while retaining one restricted communication channel? Alternatively, is there a supported mechanism for a surviving supervisor to identify, terminate and positively verify the complete execution domain of a worker, including any descendants, after its controller crashes or is suspended? What guarantees and limitations apply to stable identity, process exit, automatic relaunch and loss of the supervisor? I'm specifically seeking supported operating-system guarantees, not private sandbox profiles, polling, heartbeat inference or best-effort process-tree enumeration. The goal is to determine whether a bounded synthetic containment experiment is technically justified. No production implementation has been attempted.
Replies
5
Boosts
0
Views
207
Activity
3w
Title: Supported OS-enforced restriction of Keychain access while retaining App Sandbox and App Group UDS
I’m designing a small, controlled macOS test harness. Two separately signed, sandboxed applications communicate through a UNIX-domain socket in an App Group container. They run as non-root processes in a GUI user session. One application also launches a child that inherits its sandbox and an existing socket descriptor. Is there a documented, supported OS policy that preserves this IPC arrangement while preventing the test processes from retrieving, using or modifying credentials, including items in their own Data Protection Keychain access groups and reachable file-based keychains? The policy must also prevent creating credential stores/items outside the permitted test resources. Using a macOS-style TeamID-prefixed App Group avoids that group providing Keychain sharing, but does not establish denial of the remaining Keychain operations. Empty stores, avoiding API calls and relying on users refusing prompts are insufficient for this requirement. If a different execution context or isolation architecture is required, could you identify the supported mechanism and relevant documentation? I’m seeking platform guidance, without relying on private APIs or unsupported custom sandbox profiles.
Replies
3
Boosts
0
Views
349
Activity
3w