Security

RSS for tag

Secure the data your app manages and control access to your app using the Security framework.

Posts under Security tag

200 Posts

Post

Replies

Boosts

Views

Activity

SecItem: Fundamentals
I regularly help developers with keychain problems, both here on DevForums and for my Day Job™ in DTS. Many of these problems are caused by a fundamental misunderstanding of how the keychain works. This post is my attempt to explain that. I wrote it primarily so that Future Quinn™ can direct folks here rather than explain everything from scratch (-: If you have questions or comments about any of this, put them in a new thread and apply the Security tag so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" SecItem: Fundamentals or How I Learned to Stop Worrying and Love the SecItem API The SecItem API seems very simple. After all, it only has four function calls, how hard can it be? In reality, things are not that easy. Various factors contribute to making this API much trickier than it might seem at first glance. This post explains the fundamental underpinnings of the keychain. For information about specific issues, see its companion post, SecItem: Pitfalls and Best Practices. Keychain Documentation Your basic starting point should be Keychain Items. If your code runs on the Mac, also read TN3137 On Mac keychain APIs and implementations. Read the doc comments in <Security/SecItem.h>. In many cases those doc comments contain critical tidbits. When you read keychain documentation [1] and doc comments, keep in mind that statements specific to iOS typically apply to iPadOS, tvOS, and watchOS as well (r. 102786959). Also, they typically apply to macOS when you target the data protection keychain. Conversely, statements specific to macOS may not apply when you target the data protection keychain. [1] Except TN3137, which is very clear about this (-: Caveat Mac Developer macOS supports two different keychain implementations: the original file-based keychain and the iOS-style data protection keychain. IMPORTANT If you’re able to use the data protection keychain, do so. It’ll make your life easier. See the Careful With that Shim, Mac Developer section of SecItem: Pitfalls and Best Practices for more about this. TN3137 On Mac keychain APIs and implementations explains this distinction. It also says: The file-based keychain is on the road to deprecation. This is talking about the implementation, not any specific API. The SecItem API can’t be deprecated because it works with both the data protection keychain and the file-based keychain. However, Apple has deprecated many APIs that are specific to the file-based keychain, for example, SecKeychainCreate. TN3137 also notes that some programs, like launchd daemons, can’t use the file-based keychain. If you’re working on such a program then you don’t have to worry about the deprecation of these file-based keychain APIs. You’re already stuck with the file-based keychain implementation, so using a deprecated file-based keychain API doesn’t make things worse. The Four Freedoms^H^H^H^H^H^H^H^H Functions The SecItem API contains just four functions: SecItemAdd(_:_:) SecItemCopyMatching(_:_:) SecItemUpdate(_:_:) SecItemDelete(_:) These directly map to standard SQL database operations: SecItemAdd(_:_:) maps to INSERT. SecItemCopyMatching(_:_:) maps to SELECT. SecItemUpdate(_:_:) maps to UPDATE. SecItemDelete(_:) maps to DELETE. You can think of each keychain item class (generic password, certificate, and so on) as a separate SQL table within the database. The rows of that table are the individual keychain items for that class and the columns are the attributes of those items. Note Except for the digital identity class, kSecClassIdentity, where the values are split across the certificate and key tables. See Digital Identities Aren’t Real in SecItem: Pitfalls and Best Practices. This is not an accident. The data protection keychain is actually implemented as an SQLite database. If you’re curious about its structure, examine it on the Mac by pointing your favourite SQLite inspection tool — for example, the sqlite3 command-line tool — at the keychain database in ~/Library/Keychains/UUU/keychain-2.db, where UUU is a UUID. WARNING Do not depend on the location and structure of this file. These have changed in the past and are likely to change again in the future. If you embed knowledge of them into a shipping product, it’s likely that your product will have binary compatibility problems at some point in the future. The only reason I’m mentioning them here is because I find it helpful to poke around in the file to get a better understanding of how the API works. For information about which attributes are supported by each keychain item class — that is, what columns are in each table — see the Note box at the top of Item Attribute Keys and Values. Alternatively, look at the Attribute Key Constants doc comment in <Security/SecItem.h>. Uniqueness A critical part of the keychain model is uniqueness. How does the keychain determine if item A is the same as item B? It turns out that this is class dependent. For each keychain item class there is a set of attributes that form the uniqueness constraint for items of that class. That is, if you try to add item A where all of its attributes are the same as item B, the add fails with errSecDuplicateItem. For more information, see the errSecDuplicateItem page. It has lists of attributes that make up this uniqueness constraint, one for each class. These uniqueness constraints are a major source of confusion, as discussed in the Queries and the Uniqueness Constraints section of SecItem: Pitfalls and Best Practices. Parameter Blocks Understanding The SecItem API is a classic ‘parameter block’ API. All of its inputs are dictionaries, and you have to know which properties to set in each dictionary to achieve your desired result. Likewise for when you read properties in output dictionaries. There are five different property groups: The item class property, kSecClass, determines the class of item you’re operating on: kSecClassGenericPassword, kSecClassCertificate, and so on. The item attribute properties, like kSecAttrAccessGroup, map directly to keychain item attributes. The search properties, like kSecMatchLimit, control how the system runs a query. The return type properties, like kSecReturnAttributes, determine what values the query returns. The value type properties, like kSecValueRef perform multiple duties, as explained below. There are other properties that perform a variety of specific functions. For example, kSecUseDataProtectionKeychain tells macOS to use the data protection keychain instead of the file-based keychain. These properties are hard to describe in general; for the details, see the documentation for each such property. Inputs Each of the four SecItem functions take dictionary input parameters of the same type, CFDictionary, but these dictionaries are not the same. Different dictionaries support different property groups: The first parameter of SecItemAdd(_:_:) is an add dictionary. It supports all property groups except the search properties. The first parameter of SecItemCopyMatching(_:_:) is a query and return dictionary. It supports all property groups. The first parameter of SecItemUpdate(_:_:) is a pure query dictionary. It supports all property groups except the return type properties. Likewise for the only parameter of SecItemDelete(_:). The second parameter of SecItemUpdate(_:_:) is an update dictionary. It supports the item attribute and value type property groups. Outputs Two of the SecItem functions, SecItemAdd(_:_:) and SecItemCopyMatching(_:_:), return values. These output parameters are of type CFTypeRef because the type of value you get back depends on the return type properties you supply in the input dictionary: If you supply a single return type property, except kSecReturnAttributes, you get back a value appropriate for that return type. If you supply multiple return type properties or kSecReturnAttributes, you get back a dictionary. This supports the item attribute and value type property groups. To get a non-attribute value from this dictionary, use the value type property that corresponds to its return type property. For example, if you set kSecReturnPersistentRef in the input dictionary, use kSecValuePersistentRef to get the persistent reference from the output dictionary. In the single item case, the type of value you get back depends on the return type property and the keychain item class: For kSecReturnData you get back the keychain item’s data. This makes most sense for password items, where the data holds the password. It also works for certificate items, where you get back the DER-encoded certificate. Using this for key items is kinda sketchy. If you want to export a key, called SecKeyCopyExternalRepresentation. Using this for digital identity items is nonsensical. For kSecReturnRef you get back an object reference. This only works for keychain item classes that have an object representation, namely certificates, keys, and digital identities. You get back a SecCertificate, a SecKey, or a SecIdentity, respectively. For kSecReturnPersistentRef you get back a data value that holds the persistent reference. Value Type Subtleties There are three properties in the value type property group: kSecValueData kSecValueRef kSecValuePersistentRef Their semantics vary based on the dictionary type. For kSecValueData: In an add dictionary, this is the value of the item to add. For example, when adding a generic password item (kSecClassGenericPassword), the value of this key is a Data value containing the password. This is not supported in a query dictionary. In an update dictionary, this is the new value for the item. For kSecValueRef: In add and query dictionaries, the system infers the class property and attribute properties from the supplied object. For example, if you supply a certificate object (SecCertificate, created using SecCertificateCreateWithData), the system will infer a kSecClass value of kSecClassCertificate and various attribute values, like kSecAttrSerialNumber, from that certificate object. This is not supported in an update dictionary. For kSecValuePersistentRef: For query dictionaries, this uniquely identifies the item to operate on. This is not supported in add and update dictionaries. Revision History 2025-05-28 Expanded the Caveat Mac Developer section to cover some subtleties associated with the deprecation of the file-based keychain. 2023-09-12 Fixed various bugs in the revision history. Added a paragraph explaining how to determine which attributes are supported by each keychain item class. 2023-02-22 Made minor editorial changes. 2023-01-28 First posted.
0
0
5.1k
May ’25
Screen Recording permission popup not shown & app not added to app list in Screen Recording settings
Requesting the Screen Recording permission seems broken on macOS 27.3 beta 2. I'd love to know whether this change is intentional or whether we can expect a fix before the stable macOS 27.3 release. Feedback report: FB25646769 Behavior until macOS 27.2 When an app calls CGRequestScreenCaptureAccess(), macOS shows the following popup: Additionally, the app is added to the app list in the “Screen & System Audio Recording” panel in the System Settings. It is toggled off by default and the user can easily toggle it on. Behavior on macOS 27.3 beta 2 When an app calls CGRequestScreenCaptureAccess(), no popup appears and the app is not added to the app list in the “Screen & System Audio Recording” panel in the System Settings. The user cannot easily grant the permission. What the user has to do to grant the permission on macOS 27.3 beta 2 It is not intuitive for the user to figure out how to grant the Screen Recording permission. Without any guidance, the user needs to: Click the little plus icon below the app list in the "Screen & System Audio Recording” panel in the System Settings Because the System Settings panel shows two app lists, the user needs to click the plus icon below the correct app list ("Screen & System Audio Recording", not "System Audio Recording Only") Find the app in the file picker and add it This is cumbersome and unintuitive. There's no explanation of what to do. The average user will be confused and will struggle to complete these tasks. Reproduction steps Install an app that requests the Screen Recording permission (e.g., Cap) Get to the onboarding step that requests the Screen Recording permission Observe that the permission request popup is not shown and that the app is not added to the System Settings panel
6
1
319
13h
Secure Enclave key accessibility attribute differs from SecAccessControl creation policy
We created a persistent P-256 Secure Enclave private key on iPadOS using SecAccessControlCreateWithFlags with the following settings: kSecAttrAccessibleWhenUnlockedThisDeviceOnly privateKeyUsage userPresence Key generation, persistence across app launches and updates, and authenticated signing were successful. However, SecItemCopyMatching with kSecReturnAttributes returned an accessibility attribute of "dk" rather than the expected "aku". SecKeyCopyAttributes did not return the accessibility attribute. A signing attempt using a fresh non-interactive authentication context failed with LAError.notInteractive (-1004). Interactive signing succeeded following Face ID authentication, and the signature was independently verified. My questions are: Is the returned "dk" value expected for a persistent Secure Enclave private key created with this access control policy? Does this attribute describe the Keychain reference or the effective protection policy of the private key? Is there a supported public API to independently verify that the requested WhenUnlockedThisDeviceOnly protection is enforced? We do not intend to weaken the requested protection policy or treat these two accessibility values as equivalent without supporting evidence. Any clarification would be appreciated. Thank you.
1
0
41
15h
Enable iCloud Keychain Autofill & Touch ID support for Chromium-based browsers on macOS
Hello Apple Developer Team, I would love to see iCloud Keychain Autofill and Touch ID support extended to Chromium-based browsers on macOS (such as Ecosia, Brave, or Vivaldi). Currently, Safari allows autofill of passwords using Touch ID, but when using other browsers, I have to manually copy-paste credentials from Keychain Access, which is time-consuming. Would it be possible for Apple to provide an API or framework that allows non-WebKit browsers to integrate iCloud Keychain autofill while keeping security intact? This feature would make macOS more convenient for users who prefer alternative browsers while keeping security standards high. Thanks in advance for considering this! Best regards, Kilian
1
1
721
1d
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.
7
0
197
1d
Supported per-operation fresh administrator authentication in macOS
I am developing a macOS security application that requires strictly controlled, attended administrative operations through a protected privileged helper. Security requirements Fresh native administrator authentication for every privileged operation. Explicit confirmation of the exact operation. Cryptographic binding between the operation, authorization and transaction. Durable single-use authorization and replay protection. No collection or storage of administrator passwords by the application. No reliance on previously cached administrative credentials. Testing performed In an isolated Apple silicon macOS virtual machine, we registered a temporary custom Authorization Services right with the following policy: class = user group = admin authenticate-user = true shared = false timeout = 0 allow-root = false session-owner = false Noninteractive authorization was correctly denied with OSStatus -60007. Interactive cancellation returned OSStatus -60006. However, an interactive authorization dialog did not display the operation-specific token supplied through kAuthorizationEnvironmentPrompt. Consequently, we could not establish that the administrator had been presented with the exact operation being authorized. We also reviewed the public Endpoint Security SDK declarations for authentication, authorization petition and authorization judgement events. Although audit tokens identify participating processes, we could not identify a documented per-evaluation causal identifier linking these events. The temporary authorization right was subsequently removed. Technical questions Does macOS provide a supported public API that guarantees fresh administrator authentication for each individual evaluation of a custom authorization right? Can a trusted privileged helper independently verify the freshness of that authentication, the authenticated administrator's identity and its association with a specific authorization evaluation? Is there a documented mechanism for causally correlating Endpoint Security authentication, authorization petition and authorization judgement events, including concurrent requests and event loss? Can AuthorizationCopyInfo, LocalAuthentication or a supported authorization plug-in provide the required evidence without the application collecting administrator credentials? What supported architecture does Apple recommend for cryptographically binding fresh native administrator authentication to a specific, single-use privileged operation? We are seeking a documented and supported security architecture rather than a workaround or a reduction of macOS security protections. If these guarantees are not currently available through public APIs, confirmation of that limitation would also be extremely helpful. Thank you for your technical guidance.
1
0
390
2d
Technical feasibility — Restricting PIV RSA signing to a specific signed macOS application
Hello, I'm developing BenStrukt, a macOS application that uses RSA-2048 signatures to authorize individual operations through a local IPC protocol. We are evaluating the YubiKey 5C NFC using an RSA private key generated on-device in PIV slot 9C, configured with PIN Policy Always and Touch Policy Always. Our critical security requirement is not only that the RSA private key must be non-exportable, but also that only our specifically signed macOS application can initiate authorized signing operations. According to Apple's documentation, external token items are exposed through kSecAttrAccessGroupToken, which is accessible by default without a specific keychain access-group entitlement. Could you clarify whether there is a documented, supported mechanism to enforce application-specific authorization for PIV private-key operations on macOS? In particular, can a second application running under the same macOS user obtain a reference to the key and request a signature when the correct PIN and physical touch are supplied? Would CryptoTokenKit, a custom token extension, code-signing requirements, or another supported mechanism prevent this, including access through alternative smart-card interfaces such as PC/SC? If application-specific isolation is not supported, could you explicitly confirm this limitation? We need to establish these guarantees before purchasing hardware or modifying our existing signing architecture. Thank you for your technical guidance. Oliver BenFounder — BenStrukt
1
0
77
2d
Apple T2: Public APIs for independent watchdog control and rollback-resistant application state?
Hello, I am developing a safety-critical, automated application on a MacBook Air (Retina, 13-inch, 2020, Intel) running macOS 15. I am investigating whether the Apple T2 Security Chip can provide a hardware-backed trust boundary independent of the host macOS kernel. I have reviewed Apple's Platform Security documentation and the public Security and CryptoKit APIs for Secure Enclave key protection. I would appreciate clarification on two specific questions: 1. Independent watchdog control Is there any public, supported API that allows a third-party macOS application to configure a hardware-backed watchdog that remains effective when the entire host macOS kernel becomes unresponsive? If so, can it enforce a bounded-time host reset or shutdown independently of host OS execution? 2. Rollback-resistant application state Does the T2 or its Secure Enclave expose a public, supported mechanism for maintaining an application-defined monotonic counter or small persistent state record that cannot be rolled back by restoring an older host filesystem or database snapshot on the same Mac? Specifically, I need to distinguish the latest committed application state from an older, previously valid state, including after a crash or reboot. I understand that hardware-backed signatures and non-exportable private keys alone do not necessarily establish state freshness or prevent replay of previously signed records. If neither capability is available through public, supported APIs on Intel-based T2 Macs, an explicit clarification would also be very helpful. I am not requesting private APIs, firmware modifications, reverse engineering, or changes to macOS security settings. Thank you for your technical guidance.
1
0
170
2d
Authentication-UI refusal for a file-based certificate query on macOS
The guidance in https://developer.apple.com/forums/thread/739774 explains the context search list, the kSecMatchSearchList override and continued use of deprecated file-based APIs where that keychain model is required. For a SecItemCopyMatching query using kSecClassCertificate and an explicitly supplied file-based test keychain, what is the supported way to refuse authentication UI rather than allow a prompt? I am considering macOS 26.6.1 with the macOS 27.0 SDK; please clarify applicability to that combination and any relevant application-context restrictions. In particular, which refusal mechanism applies to the file-based path given the deprecation of earlier authentication-UI options? If access would require keychain unlock or authentication UI, is an error guaranteed, or can the query omit items and return success? A public documentation reference and any version limitations would be helpful. This is a contract question for a prospective test; I have not run it or reproduced a problem.
1
0
126
2d
Supported per-operation fresh administrator authentication evidence in macOS
We are designing a macOS privileged helper for attended local administrative operations. Each operation must require a new native administrator authentication, separate protected confirmation of the exact operation, and durable single-use consumption. The app must never collect administrator passwords. A successful right evaluation or an existing administrative session alone is insufficient. In an isolated arm64 macOS VM (build 26B131), we tested a custom inert Authorization Services right with class=user, group=admin, authenticate-user=true, shared=false, timeout=0, allow-root=false. The noninteractive request was denied and cancellation was observed. A subsequent interactive request displayed a dialog without the expected custom prompt token; the test stopped without establishing positive exact consent. The temporary right has been removed. No privileged effect was performed. We reviewed ES_EVENT_TYPE_NOTIFY_AUTHENTICATION, ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_PETITION, and ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_JUDGEMENT and the corresponding SDK structures. Audit tokens identify processes, but we could not identify a documented per-evaluation correlation identifier joining a specific authentication event to a particular right evaluation. Is there a supported public API or documented policy contract that guarantees a fresh native administrator authentication (not a cached credential or an existing session) for a specific custom right evaluation? If so, how can the trusted helper verify freshness, the authenticated administrator identity or membership, and association with that particular evaluation, without handling credentials? Is there a supported causal identifier or documented correlation guarantee for the three Endpoint Security notifications, including concurrent requests and lost events? If an authorization plug-in or AuthorizationCopyInfo is relevant, what guarantees are documented for freshness and provenance of the data returned? If no such mechanism is supported, is there an Apple-recommended architecture meeting these requirements without weakening them? We are asking for API semantics and a supported design, not a workaround for security controls. We can provide a minimal inert reproducer if needed.
1
0
93
2d
Supported per-operation fresh administrator authentication evidence in macOS
We are designing a macOS privileged helper for attended local administrative operations. Each operation must require a new native administrator authentication, separate protected confirmation of the exact operation, and durable single-use consumption. The app must never collect administrator passwords. A successful right evaluation or an existing administrative session alone is insufficient. In an isolated arm64 macOS VM (build 26B131), we tested a custom inert Authorization Services right with class=user, group=admin, authenticate-user=true, shared=false, timeout=0, allow-root=false. The noninteractive request was denied and cancellation was observed. A subsequent interactive request displayed a dialog without the expected custom prompt token; the test stopped without establishing positive exact consent. The temporary right has been removed. No privileged effect was performed. We reviewed ES_EVENT_TYPE_NOTIFY_AUTHENTICATION, ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_PETITION, and ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_JUDGEMENT and the corresponding SDK structures. Audit tokens identify processes, but we could not identify a documented per-evaluation correlation identifier joining a specific authentication event to a particular right evaluation. Is there a supported public API or documented policy contract that guarantees a fresh native administrator authentication (not a cached credential or an existing session) for a specific custom right evaluation? If so, how can the trusted helper verify freshness, the authenticated administrator identity or membership, and association with that particular evaluation, without handling credentials? Is there a supported causal identifier or documented correlation guarantee for the three Endpoint Security notifications, including concurrent requests and lost events? If an authorization plug-in or AuthorizationCopyInfo is relevant, what guarantees are documented for freshness and provenance of the data returned? If no such mechanism is supported, is there an Apple-recommended architecture meeting these requirements without weakening them? We are asking for API semantics and a supported design, not a workaround for security controls. We can provide a minimal inert reproducer if needed.
1
0
97
2d
APFS snapshots: documented guarantees for backing-storage identity and exclusion of non-root writers
We are developing MasterVault Clean Room, a governed data system whose validation gate evaluates recorded claims. Each successful validation must refer to one stable, identifiable input view, protected from capture through final consumption. We trust the macOS kernel and approved Apple storage stack, and are evaluating APFS snapshots as a candidate mechanism, but need to establish the backing-storage boundary before relying on them. 1. Binding the open file to its complete backing storage What supported interfaces let a process start with an open file descriptor on an APFS snapshot, identify its complete backing-storage chain, and reject disk-image-backed or other file-backed sources? We need to bind this evidence to the snapshot actually being read. A pathname, mount-point inspection, or independently obtained device identity is insufficient unless the supported semantics establish that binding and address changes during verification. If someone could identify the documented guarantees and limitations of any supported verification sequence, it would be emminently helpful. 2. Excluding non-root writable access through final consumption What supported mechanism or deployment configuration can establish that no non-root actor retains writable access to that backing storage, from capture through final consumption? This must account for: Writable disk-image files or other file-backed storage beneath the snapshot. Pre-existing writable raw/block-device handles. Aliases or alternate access paths to the same backing storage. Changes to the backing-storage configuration during that interval. A read-only snapshot mount and current ownership or device-permission checks alone do not establish this requirement: they do not demonstrate that previously acquired writable access is absent or has been revoked. What we need from the platform Please identify: The supported interfaces and their documented guarantees. Required privileges, supported macOS versions, and storage configurations. Deployment restrictions needed to establish and maintain the boundary. Any part of this requirement that cannot be established through supported public interfaces. We can restrict our supported deployment configurations where necessary, but those restrictions must have a documented basis. The general APFS overview explains features such as cloning, shared space, and sparse files. It does not answer these backing-storage identity and writer-exclusion questions. Likewise, describing snapshots as read-only does not by itself resolve whether their backing storage can be altered through another route. We are seeking platform semantics and supported mechanisms, not Apple certification of MasterVault. This information will determine our admission checks, supported configurations, and qualification tests. If the guarantee is unavailable—or cannot be substantiated for a particular configuration—our validation must remain unresolved, rather than report assurance we cannot support.
0
0
143
5d
Sandbox restriction blocks Keychain access during Live Activity rendering: supported design for encrypted updates?
Hi, I'm building a Live Activity prototype using fictitious data. I want incoming updates to stay encrypted until they reach my iPhone, without putting the decryption key in ActivityAttributes, ContentState, or archived views. My goal is timely updates without an alert for each change. I'm using Xcode 27.2 and the iPhoneOS 27.2 SDK. My iPhone was running iOS 27.2.1 when I last checked. I haven't recorded its exact OS build or the OS version and build for every earlier test. My app and WidgetKit extension have the same shared Keychain access group in their signed entitlements. My app creates a 32-byte test key as a generic password with kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, with synchronization disabled. The extension only reads the key. A failed lookup never causes the key to be replaced or deleted. When I try to read the key while rendering the Live Activity, the first, metadata-only SecItemCopyMatching call returns errSecNotAvailable (-25291). It fails before I request any secret bytes. I reproduced this after stopping and restarting the activity with my iPhone unlocked. I get the same result with a non-interactive LAContext and with kSecUseAuthenticationUIFail without a supplied context. I used the latter only for comparison, since it is deprecated. My query specifies the class, fixed service and account, and shared access group. It also sets kSecUseDataProtectionKeychain. For the metadata lookup, I use kSecAttrSynchronizableAny, kSecReturnAttributes: true, and kSecMatchLimitAll, without requesting data or item references. I only request the key bytes after finding exactly one item and validating its policy, so that second step is never reached here. For comparison, I added a regular widget to the same signed WidgetKit extension. Its timeline provider successfully validates the metadata using the same read-only query and client, while the Live Activity still returns errSecNotAvailable. I captured these results separately; I haven't established whether they ran simultaneously or in different processes. I have only confirmed metadata access in the regular widget, not access to the key bytes. I also tried decrypting in my foreground app and then passing the fictitious summary to ActivityKit through a local update. That renders correctly on my iPhone. It doesn't test remote delivery or background decryption, or fix the Keychain failure during rendering. I repeated the test with debug messages enabled in Console. The Live Activity in my diagnostic build still shows the same Keychain failure. The capture from the extension now includes the connection error, not just the generic securityd message: activating connection: ... name=com.apple.securityd failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159] invalidated after a failed init got event: Connection invalid Failed to talk to securityd after 4 attempts. error:[-25291] Error Domain=com.apple.security.xpc Code=3 Connection invalid - Connection init failed at lookup with error 159 - Sandbox restrictionThis excerpt omits connection addresses and account fields. The same -25291 error and sandbox-restriction reason appear five times in this capture. It establishes the reported reason for the connection failure in this test; I haven't established whether this is an intended restriction, an OS issue, or a configuration issue. I also don't infer the actual retry count from the generic message. I'd appreciate guidance on these questions: Given the explicit sandbox-restriction error for com.apple.securityd, is non-interactive Keychain access intentionally unavailable during Live Activity rendering, or should I investigate an OS or configuration issue? Displaying live data with Live Activities documents a separate sandbox and restrictions on network and location access, but I haven't found its Keychain access contract. How should I interpret the different result from my regular widget's timeline provider? For encrypted content-state updates, is there a supported execution point where my app can authenticate and decrypt each update before handing a local render value to ActivityKit? I found the documented app wake-up for push-to-start, but not an equivalent for ordinary updates. If neither approach is supported, how can I deliver timely, alert-free encrypted Live Activity updates while keeping the key solely in Keychain and out of archived state and views? How does ActivityKit protect static ActivityAttributes at rest? Can those attributes be included in backups or replicated to an Apple Watch or Mac, separately from rendered views? Does any of that data pass through Apple servers, and is there a public API to opt out of replication? Would a per-activity session key in locally created static attributes be a supported design, or does Apple advise against storing secrets there? I haven't implemented this alternative. I would keep the long-term pairing key in Keychain, exclude the session key from every APNs payload, and start the activity locally rather than through push-to-start. I'd like to understand the storage and replication guarantees before considering it further. I'm looking for a supported design without weakening Keychain protection, allowing authentication UI during rendering, or suppressing an ordinary notification to bypass its requirements. I can prepare a minimal reproducer with fictitious data and no tokens, real identifiers, or conversation content. Thanks for your help.
4
0
189
5d
CKKS zone deletions return success but stale 2019 key hierarchy persists; "Delete iCloud Data" not offered (FB25584356)
I filed FB25584356 for this and would appreciate any pointers. Setup: Mac mini on macOS 27.2.1 and an iPhone on iOS 27.2, same Apple Account, HSA2, Advanced Data Protection off. Octagon is healthy (otctl status = Ready, both devices trusted). Symptoms: AirDrop to my own iPhone fails when I pick the device (rapportd: "PairVerify server M2 failed: copy identity"), iPhone Mirroring ends with noCompatiblePhone, and various clients log CKErrorDomain 111 / 5009 "Keychain Sync Incomplete". What I see in CKKS: seven zones (AutoUnlock, LimitedPeersAllowed, Home, Manatee, ApplePay, Health, Engram) still hold a key hierarchy from August 2019. The only TLKShare was issued by a device that left the account years ago, so neither current device can unwrap the TLK ("No trusted TLKShares", CKKSErrorDomain 35). secd then does what I would expect: tlkmissing → "No other devices claim to have the TLK. Resetting zone..." → CKKSDeleteCKZoneOperation → local reset → zones recreated. The delete appears to succeed. With debug logging, cloudd shows status:200 and "RecordZone ... was successfully deleted from the server" for each zone. The next fetch returns the same 2019 records with an identical server change token. Over about 11 hours: 124 reset cycles, 869 zone deletions reported as successful, 182 consecutive AutoUnlock fetches with the same change token. When not throttled it runs roughly every 5 seconds; CloudKit eventually answers "Service Unavailable" (CKError 6/2009) with a ~59 minute retry-after, and all 23 zones are unusable in the meantime. ckksctl -v AutoUnlock reset-cloudkit behaves the same way. Reset path: Support article 120862 describes "Don't know passcode?" → "Forgot all passcodes?" → "More Options" → "Delete iCloud Data". With the Mac signed in but not yet trusted, "Don't know passcode?" only offered Cancel / Try Again Later, in the sign-in flow and in both System Settings follow-ups. After three wrong passcodes the alert had a single "Try Again Later" button, although cdpd logged "Creating recovery option: Reset". Questions: Is a client-side zone delete expected to be a no-op for these zones while the server reports success? Is there a supported way to reach performCKServerUnreadableDataRemoval / "Delete iCloud Data" when another trusted device exists? I am fine with losing the end-to-end encrypted data in those zones. Logs and a sysdiagnose are attached to the Feedback.
1
0
181
1w
Is JIT execution possible for ordinary third-party iOS apps?
I'm researching whether a normally signed third-party iOS application can use Just-In-Time (JIT) compilation on a stock, unjailbroken iPhone. My project, Kairavox, aims to run a genuine, unmodified iPadOS installation as a guest inside a native iOS application. JIT compilation is central to our intended execution architecture: we want to translate and execute guest AArch64 instructions through dynamically generated native code. We intend to test through personal development signing and sideloading using AltStore or SideStore. App Store distribution is not a requirement. I've found Apple's documentation for: Allow Execution of Just-In-Time (JIT) Compiled Code Entitlement Porting Just-In-Time Compilers to Apple Silicon Alternative Browser Engines in the European Union However, the first two appear to concern the macOS Hardened Runtime context. Apple's alternative browser engine provisions also describe a specifically authorized exception, which does not describe our application. I'd appreciate clarification on what is supported for an ordinary third-party iOS app: Is there a documented iOS API or entitlement that allows a normally signed third-party app to allocate writable memory, generate machine code, and execute that code at runtime? Does iOS support MAP_JIT for ordinary third-party applications, or is it restricted to other Apple platforms or specially authorized applications? Is com.apple.security.cs.allow-jit exclusively a macOS Hardened Runtime entitlement, or does it have any application on iOS? Can an app using free Personal Team development signing execute JIT-generated code? Does paid Apple Developer Program membership change this? Do development, ad hoc, or other signing arrangements differ in their JIT permissions? Is there a documented process for an independent developer to request the necessary capability? Does installing an app through AltStore or SideStore change its OS-granted executable-memory permissions, or does it retain the permissions associated with its signed build? Are there any documented restrictions on using JIT-generated native code for CPU emulation or virtualization workloads? I understand that Apple's EU alternative-browser-engine authorization is a narrow exception for eligible browser applications. I'm not assuming it applies to Kairavox. The main question is whether an independent developer can build and test a JIT-based application on a stock iPhone using an officially supported signing and permission model. Thank you.
1
0
126
1w
macOS APFS: com.apple.macl and UF_TRACKED appear after creating a hard link — safe file replacement and rollback?
I'm investigating an unexpected metadata change during a controlled file deployment on macOS. Environment and observed state Two regular configuration files are used by a local service. Before replacement, the first file had: SHA-256: verified. File flags: 0. Extended attributes: none. Hard-link count: 1. Owner/group: 501/20. Permissions: 0644. ACL: empty. A backup procedure created a hard link to preserve the original inode before replacing the active pathname with an independently created file. Immediately after creating and verifying the hard link, the original file was observed with: The same SHA-256 and inode. Flags: 64 (UF_TRACKED). Extended attribute: com.apple.macl. Hard-link count: 2. No file content was replaced. The procedure stopped because the metadata no longer matched the original baseline. Additional observations Other backup methods also encountered unexpected metadata changes during destination creation. Tests using renamex_np with RENAME_SWAP successfully exchanged and restored artificial files with flags 0 and empty extended attributes. A test with artificial files already containing com.apple.provenance also succeeded. We could not reproduce the specific UF_TRACKED + com.apple.macl + two-hard-link state in an isolated fixture using ordinary documented operations. The operational original and its second hard link currently share the same inode. No attempt has been made to remove the protected attribute or change its flags. Questions for Apple filesystem/security specialists Under what documented circumstances can creating a hard link or related Finder/TCC document-tracking behavior cause UF_TRACKED and com.apple.macl to appear on an existing file? Are these metadata changes expected for a file accessed through a user-authorized Documents location? What supported mechanism can preserve the current original inode and provide a verifiable rollback when replacing its active pathname? Is renamex_np(..., RENAME_SWAP) appropriate for this situation, and what special considerations apply to the existing second hard link and protected extended attributes? What verification criteria would you recommend before permitting a production replacement? I am looking for a documented, reversible procedure that preserves macOS security protections. I do not want to disable SIP, forcibly remove com.apple.macl, or bypass TCC. I can provide sanitized metadata comparisons and a minimal reproduction if needed.
1
0
178
1w
Client identity selection and chain presentation when an intermediate CA in the identity’s chain is revoked
We deploy client-authentication identities (certificate + private key) to iOS/iPadOS devices for mutual TLS and Wi-Fi EAP-TLS. The identities are installed via MDM configuration profiles and used from Safari, from our app via URLSession client certificate challenges, and by the system for EAP-TLS. The intermediate CA certificate in these identities’ chain (issued by a publicly trusted root) will be revoked. A replacement intermediate certificate with the same subject and public key, but a different serial number, is valid, and the end-entity certificates will not be reissued. The private keys are not exportable. If the revoked intermediate is known to the device through Apple’s distributed revocation data, or only through the root CA’s CRL, does iOS/iPadOS evaluate this when offering the identity for selection in Safari, when handling a URLSession client certificate challenge, or when using it for EAP-TLS? Could the identity be hidden, flagged, or fail to be presented? If we install the replacement intermediate on the device (e.g. via a certificate payload in a configuration profile) and remove the original, will the system build and present the chain through the replacement certificate? For URLSession, if our app supplies the chain explicitly in URLCredential(identity:certificates:persistence:), is any revocation evaluation performed on that chain on the client side? The revocation is scheduled for 2026-11-20T09:00:00Z. Our users rely on this system for patient care in medical institutions, so any guidance before then would be greatly appreciated.
2
5
594
2w
macOS 27/APFS: Supported ACL Absence Verification When acl_get_fd_np Returns ENOENT
Subject: Supported fail-closed ACL absence verification on macOS 27.0.1 / APFS Environment: macOS 27.0.1, build 26A434; APFS; installed macOS 27.0 SDK. We need a supported, documented way to determine whether an existing filesystem object has no effective ACL entries, while rejecting genuine retrieval failures and unsupported or unavailable ACL evidence. We are seeking clarification of the public interface contract, not alleging an Apple defect. For existing directory and regular-file fixtures, pathname metadata and descriptor metadata identify the same object. Errno is cleared immediately before each native call and captured immediately afterward. ACL retrieval uses ACL_TYPE_EXTENDED: acl_get_file(path, ACL_TYPE_EXTENDED) acl_get_fd_np(fd, ACL_TYPE_EXTENDED) On fresh objects, both return NULL with ENOENT. Explicit one-entry fixture ACLs are retrieved successfully. Explicit zero-entry fixture ACLs can also yield NULL/ENOENT, while attribute queries return a serialized zero-entry ACL. The attribute queries use getattrlist() and descriptor-bound fgetattrlist(), requesting ATTR_CMN_RETURNED_ATTRS | ATTR_CMN_EXTENDED_SECURITY, with FSOPT_NOFOLLOW | FSOPT_REPORT_FULLSIZE and WITHOUT FSOPT_PACK_INVAL_ATTRS. Buffer lengths, variable-reference bounds and returned-attribute validity are checked. For the existing directories of interest, both calls succeed but omit the ATTR_CMN_EXTENDED_SECURITY returned bit. Explicit populated and zero-entry fixture records do set the bit. APFS reports valid VOL_CAP_INT_EXTENDED_SECURITY support; we do not assume that volume capability proves per-object ACL availability. On macOS 27.0.1, build 26A434, using APFS, which supported interface and documented conditions allow software to distinguish an absent ACL from unavailable or unsupported ACL evidence when descriptor-bound attribute queries succeed but omit ATTR_CMN_EXTENDED_SECURITY and native ACL getters return ENOENT for an existing object? Please clarify: Whether ENOENT has a supported ACL-absence interpretation, and under exactly which checked conditions. Whether an omitted extended-security attribute can establish ACL absence, rather than unavailable or unsupported evidence. How explicit zero-entry ACLs differ from absent ACL records through supported interfaces. How KAUTH_FILESEC_NOACL should be interpreted through supported APIs. How genuine retrieval failures, including permission, I/O, allocation and unsupported-operation errors, must remain distinguishable. Whether a supported descriptor-bound verification method exists that preserves fail-closed security checks and object identity binding; please identify its guarantees and limitations regarding pathname/ancestor changes and later operations. Whether relevant behavior is specific to this macOS/APFS version. Please identify the applicable public documentation or supported verification sequence. We do not want to modify permissions, synthesize ACLs on target objects, treat invalid-attribute defaults as real evidence, or accept ambiguous omission/ENOENT as success. Existing ownership, mode and confinement checks must remain separate mandatory checks. If no public API can make this distinction reliably, please state that limitation.
15
0
623
2w
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
219
2w
Choosing a TLS server identity by client address with NWListener
I run an HTTPS server on NWListener (iOS and macOS) that serves several identities from one listener on port 443, picked per handshake in sec_protocol_options_set_challenge_block, as suggested in this thread. That works well for every handshake that carries a server name. The trouble is handshakes without one. Clients on the LAN connect by IP address, so they send no SNI (RFC 6066 keeps IP literals out of it), and they trust a self-signed certificate through a configuration profile. Internet clients and scanners that reach the public address through the router's port forward also often arrive without SNI. The two groups should get different certificates, and the only thing that tells them apart is the client's address. The listener knows it in newConnectionHandler, but the challenge block never sees it. What I tried: sec_protocol_metadata_t has accessors for the server name, ALPN, version, cipher suite and so on, but I can't find one for the connection's endpoints. Setting a challenge block on the accepted connection's own TLS options before start(): listener.newConnectionHandler = { connection in let remote = connection.endpoint if let tls = connection.parameters.defaultProtocolStack.applicationProtocols .compactMap({ $0 as? NWProtocolTLS.Options }).first { sec_protocol_options_set_challenge_block(tls.securityProtocolOptions, { _, complete in complete(identity(for: remote)) }, queue) } connection.start(queue: queue) }This block never runs. The listener's own block answers every handshake (tested on macOS 27.2). My questions: Is there a supported way to choose the server identity per connection based on its endpoints, short of terminating TLS myself? Is the challenge block supported under TLS 1.3 by now? I also see it run twice for every handshake; is that expected? When a server-side handshake fails, connection.metadata(definition: NWProtocolTLS.definition) returns nil. Is there any way to learn which server name a failed handshake asked for, so it can be logged? I filed FB25541009 with a small sample project that shows all three.
2
0
115
2w
SecItem: Fundamentals
I regularly help developers with keychain problems, both here on DevForums and for my Day Job™ in DTS. Many of these problems are caused by a fundamental misunderstanding of how the keychain works. This post is my attempt to explain that. I wrote it primarily so that Future Quinn™ can direct folks here rather than explain everything from scratch (-: If you have questions or comments about any of this, put them in a new thread and apply the Security tag so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" SecItem: Fundamentals or How I Learned to Stop Worrying and Love the SecItem API The SecItem API seems very simple. After all, it only has four function calls, how hard can it be? In reality, things are not that easy. Various factors contribute to making this API much trickier than it might seem at first glance. This post explains the fundamental underpinnings of the keychain. For information about specific issues, see its companion post, SecItem: Pitfalls and Best Practices. Keychain Documentation Your basic starting point should be Keychain Items. If your code runs on the Mac, also read TN3137 On Mac keychain APIs and implementations. Read the doc comments in <Security/SecItem.h>. In many cases those doc comments contain critical tidbits. When you read keychain documentation [1] and doc comments, keep in mind that statements specific to iOS typically apply to iPadOS, tvOS, and watchOS as well (r. 102786959). Also, they typically apply to macOS when you target the data protection keychain. Conversely, statements specific to macOS may not apply when you target the data protection keychain. [1] Except TN3137, which is very clear about this (-: Caveat Mac Developer macOS supports two different keychain implementations: the original file-based keychain and the iOS-style data protection keychain. IMPORTANT If you’re able to use the data protection keychain, do so. It’ll make your life easier. See the Careful With that Shim, Mac Developer section of SecItem: Pitfalls and Best Practices for more about this. TN3137 On Mac keychain APIs and implementations explains this distinction. It also says: The file-based keychain is on the road to deprecation. This is talking about the implementation, not any specific API. The SecItem API can’t be deprecated because it works with both the data protection keychain and the file-based keychain. However, Apple has deprecated many APIs that are specific to the file-based keychain, for example, SecKeychainCreate. TN3137 also notes that some programs, like launchd daemons, can’t use the file-based keychain. If you’re working on such a program then you don’t have to worry about the deprecation of these file-based keychain APIs. You’re already stuck with the file-based keychain implementation, so using a deprecated file-based keychain API doesn’t make things worse. The Four Freedoms^H^H^H^H^H^H^H^H Functions The SecItem API contains just four functions: SecItemAdd(_:_:) SecItemCopyMatching(_:_:) SecItemUpdate(_:_:) SecItemDelete(_:) These directly map to standard SQL database operations: SecItemAdd(_:_:) maps to INSERT. SecItemCopyMatching(_:_:) maps to SELECT. SecItemUpdate(_:_:) maps to UPDATE. SecItemDelete(_:) maps to DELETE. You can think of each keychain item class (generic password, certificate, and so on) as a separate SQL table within the database. The rows of that table are the individual keychain items for that class and the columns are the attributes of those items. Note Except for the digital identity class, kSecClassIdentity, where the values are split across the certificate and key tables. See Digital Identities Aren’t Real in SecItem: Pitfalls and Best Practices. This is not an accident. The data protection keychain is actually implemented as an SQLite database. If you’re curious about its structure, examine it on the Mac by pointing your favourite SQLite inspection tool — for example, the sqlite3 command-line tool — at the keychain database in ~/Library/Keychains/UUU/keychain-2.db, where UUU is a UUID. WARNING Do not depend on the location and structure of this file. These have changed in the past and are likely to change again in the future. If you embed knowledge of them into a shipping product, it’s likely that your product will have binary compatibility problems at some point in the future. The only reason I’m mentioning them here is because I find it helpful to poke around in the file to get a better understanding of how the API works. For information about which attributes are supported by each keychain item class — that is, what columns are in each table — see the Note box at the top of Item Attribute Keys and Values. Alternatively, look at the Attribute Key Constants doc comment in <Security/SecItem.h>. Uniqueness A critical part of the keychain model is uniqueness. How does the keychain determine if item A is the same as item B? It turns out that this is class dependent. For each keychain item class there is a set of attributes that form the uniqueness constraint for items of that class. That is, if you try to add item A where all of its attributes are the same as item B, the add fails with errSecDuplicateItem. For more information, see the errSecDuplicateItem page. It has lists of attributes that make up this uniqueness constraint, one for each class. These uniqueness constraints are a major source of confusion, as discussed in the Queries and the Uniqueness Constraints section of SecItem: Pitfalls and Best Practices. Parameter Blocks Understanding The SecItem API is a classic ‘parameter block’ API. All of its inputs are dictionaries, and you have to know which properties to set in each dictionary to achieve your desired result. Likewise for when you read properties in output dictionaries. There are five different property groups: The item class property, kSecClass, determines the class of item you’re operating on: kSecClassGenericPassword, kSecClassCertificate, and so on. The item attribute properties, like kSecAttrAccessGroup, map directly to keychain item attributes. The search properties, like kSecMatchLimit, control how the system runs a query. The return type properties, like kSecReturnAttributes, determine what values the query returns. The value type properties, like kSecValueRef perform multiple duties, as explained below. There are other properties that perform a variety of specific functions. For example, kSecUseDataProtectionKeychain tells macOS to use the data protection keychain instead of the file-based keychain. These properties are hard to describe in general; for the details, see the documentation for each such property. Inputs Each of the four SecItem functions take dictionary input parameters of the same type, CFDictionary, but these dictionaries are not the same. Different dictionaries support different property groups: The first parameter of SecItemAdd(_:_:) is an add dictionary. It supports all property groups except the search properties. The first parameter of SecItemCopyMatching(_:_:) is a query and return dictionary. It supports all property groups. The first parameter of SecItemUpdate(_:_:) is a pure query dictionary. It supports all property groups except the return type properties. Likewise for the only parameter of SecItemDelete(_:). The second parameter of SecItemUpdate(_:_:) is an update dictionary. It supports the item attribute and value type property groups. Outputs Two of the SecItem functions, SecItemAdd(_:_:) and SecItemCopyMatching(_:_:), return values. These output parameters are of type CFTypeRef because the type of value you get back depends on the return type properties you supply in the input dictionary: If you supply a single return type property, except kSecReturnAttributes, you get back a value appropriate for that return type. If you supply multiple return type properties or kSecReturnAttributes, you get back a dictionary. This supports the item attribute and value type property groups. To get a non-attribute value from this dictionary, use the value type property that corresponds to its return type property. For example, if you set kSecReturnPersistentRef in the input dictionary, use kSecValuePersistentRef to get the persistent reference from the output dictionary. In the single item case, the type of value you get back depends on the return type property and the keychain item class: For kSecReturnData you get back the keychain item’s data. This makes most sense for password items, where the data holds the password. It also works for certificate items, where you get back the DER-encoded certificate. Using this for key items is kinda sketchy. If you want to export a key, called SecKeyCopyExternalRepresentation. Using this for digital identity items is nonsensical. For kSecReturnRef you get back an object reference. This only works for keychain item classes that have an object representation, namely certificates, keys, and digital identities. You get back a SecCertificate, a SecKey, or a SecIdentity, respectively. For kSecReturnPersistentRef you get back a data value that holds the persistent reference. Value Type Subtleties There are three properties in the value type property group: kSecValueData kSecValueRef kSecValuePersistentRef Their semantics vary based on the dictionary type. For kSecValueData: In an add dictionary, this is the value of the item to add. For example, when adding a generic password item (kSecClassGenericPassword), the value of this key is a Data value containing the password. This is not supported in a query dictionary. In an update dictionary, this is the new value for the item. For kSecValueRef: In add and query dictionaries, the system infers the class property and attribute properties from the supplied object. For example, if you supply a certificate object (SecCertificate, created using SecCertificateCreateWithData), the system will infer a kSecClass value of kSecClassCertificate and various attribute values, like kSecAttrSerialNumber, from that certificate object. This is not supported in an update dictionary. For kSecValuePersistentRef: For query dictionaries, this uniquely identifies the item to operate on. This is not supported in add and update dictionaries. Revision History 2025-05-28 Expanded the Caveat Mac Developer section to cover some subtleties associated with the deprecation of the file-based keychain. 2023-09-12 Fixed various bugs in the revision history. Added a paragraph explaining how to determine which attributes are supported by each keychain item class. 2023-02-22 Made minor editorial changes. 2023-01-28 First posted.
Replies
0
Boosts
0
Views
5.1k
Activity
May ’25
Screen Recording permission popup not shown & app not added to app list in Screen Recording settings
Requesting the Screen Recording permission seems broken on macOS 27.3 beta 2. I'd love to know whether this change is intentional or whether we can expect a fix before the stable macOS 27.3 release. Feedback report: FB25646769 Behavior until macOS 27.2 When an app calls CGRequestScreenCaptureAccess(), macOS shows the following popup: Additionally, the app is added to the app list in the “Screen & System Audio Recording” panel in the System Settings. It is toggled off by default and the user can easily toggle it on. Behavior on macOS 27.3 beta 2 When an app calls CGRequestScreenCaptureAccess(), no popup appears and the app is not added to the app list in the “Screen & System Audio Recording” panel in the System Settings. The user cannot easily grant the permission. What the user has to do to grant the permission on macOS 27.3 beta 2 It is not intuitive for the user to figure out how to grant the Screen Recording permission. Without any guidance, the user needs to: Click the little plus icon below the app list in the "Screen & System Audio Recording” panel in the System Settings Because the System Settings panel shows two app lists, the user needs to click the plus icon below the correct app list ("Screen & System Audio Recording", not "System Audio Recording Only") Find the app in the file picker and add it This is cumbersome and unintuitive. There's no explanation of what to do. The average user will be confused and will struggle to complete these tasks. Reproduction steps Install an app that requests the Screen Recording permission (e.g., Cap) Get to the onboarding step that requests the Screen Recording permission Observe that the permission request popup is not shown and that the app is not added to the System Settings panel
Replies
6
Boosts
1
Views
319
Activity
13h
Secure Enclave key accessibility attribute differs from SecAccessControl creation policy
We created a persistent P-256 Secure Enclave private key on iPadOS using SecAccessControlCreateWithFlags with the following settings: kSecAttrAccessibleWhenUnlockedThisDeviceOnly privateKeyUsage userPresence Key generation, persistence across app launches and updates, and authenticated signing were successful. However, SecItemCopyMatching with kSecReturnAttributes returned an accessibility attribute of "dk" rather than the expected "aku". SecKeyCopyAttributes did not return the accessibility attribute. A signing attempt using a fresh non-interactive authentication context failed with LAError.notInteractive (-1004). Interactive signing succeeded following Face ID authentication, and the signature was independently verified. My questions are: Is the returned "dk" value expected for a persistent Secure Enclave private key created with this access control policy? Does this attribute describe the Keychain reference or the effective protection policy of the private key? Is there a supported public API to independently verify that the requested WhenUnlockedThisDeviceOnly protection is enforced? We do not intend to weaken the requested protection policy or treat these two accessibility values as equivalent without supporting evidence. Any clarification would be appreciated. Thank you.
Replies
1
Boosts
0
Views
41
Activity
15h
Enable iCloud Keychain Autofill & Touch ID support for Chromium-based browsers on macOS
Hello Apple Developer Team, I would love to see iCloud Keychain Autofill and Touch ID support extended to Chromium-based browsers on macOS (such as Ecosia, Brave, or Vivaldi). Currently, Safari allows autofill of passwords using Touch ID, but when using other browsers, I have to manually copy-paste credentials from Keychain Access, which is time-consuming. Would it be possible for Apple to provide an API or framework that allows non-WebKit browsers to integrate iCloud Keychain autofill while keeping security intact? This feature would make macOS more convenient for users who prefer alternative browsers while keeping security standards high. Thanks in advance for considering this! Best regards, Kilian
Replies
1
Boosts
1
Views
721
Activity
1d
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
7
Boosts
0
Views
197
Activity
1d
Supported per-operation fresh administrator authentication in macOS
I am developing a macOS security application that requires strictly controlled, attended administrative operations through a protected privileged helper. Security requirements Fresh native administrator authentication for every privileged operation. Explicit confirmation of the exact operation. Cryptographic binding between the operation, authorization and transaction. Durable single-use authorization and replay protection. No collection or storage of administrator passwords by the application. No reliance on previously cached administrative credentials. Testing performed In an isolated Apple silicon macOS virtual machine, we registered a temporary custom Authorization Services right with the following policy: class = user group = admin authenticate-user = true shared = false timeout = 0 allow-root = false session-owner = false Noninteractive authorization was correctly denied with OSStatus -60007. Interactive cancellation returned OSStatus -60006. However, an interactive authorization dialog did not display the operation-specific token supplied through kAuthorizationEnvironmentPrompt. Consequently, we could not establish that the administrator had been presented with the exact operation being authorized. We also reviewed the public Endpoint Security SDK declarations for authentication, authorization petition and authorization judgement events. Although audit tokens identify participating processes, we could not identify a documented per-evaluation causal identifier linking these events. The temporary authorization right was subsequently removed. Technical questions Does macOS provide a supported public API that guarantees fresh administrator authentication for each individual evaluation of a custom authorization right? Can a trusted privileged helper independently verify the freshness of that authentication, the authenticated administrator's identity and its association with a specific authorization evaluation? Is there a documented mechanism for causally correlating Endpoint Security authentication, authorization petition and authorization judgement events, including concurrent requests and event loss? Can AuthorizationCopyInfo, LocalAuthentication or a supported authorization plug-in provide the required evidence without the application collecting administrator credentials? What supported architecture does Apple recommend for cryptographically binding fresh native administrator authentication to a specific, single-use privileged operation? We are seeking a documented and supported security architecture rather than a workaround or a reduction of macOS security protections. If these guarantees are not currently available through public APIs, confirmation of that limitation would also be extremely helpful. Thank you for your technical guidance.
Replies
1
Boosts
0
Views
390
Activity
2d
Technical feasibility — Restricting PIV RSA signing to a specific signed macOS application
Hello, I'm developing BenStrukt, a macOS application that uses RSA-2048 signatures to authorize individual operations through a local IPC protocol. We are evaluating the YubiKey 5C NFC using an RSA private key generated on-device in PIV slot 9C, configured with PIN Policy Always and Touch Policy Always. Our critical security requirement is not only that the RSA private key must be non-exportable, but also that only our specifically signed macOS application can initiate authorized signing operations. According to Apple's documentation, external token items are exposed through kSecAttrAccessGroupToken, which is accessible by default without a specific keychain access-group entitlement. Could you clarify whether there is a documented, supported mechanism to enforce application-specific authorization for PIV private-key operations on macOS? In particular, can a second application running under the same macOS user obtain a reference to the key and request a signature when the correct PIN and physical touch are supplied? Would CryptoTokenKit, a custom token extension, code-signing requirements, or another supported mechanism prevent this, including access through alternative smart-card interfaces such as PC/SC? If application-specific isolation is not supported, could you explicitly confirm this limitation? We need to establish these guarantees before purchasing hardware or modifying our existing signing architecture. Thank you for your technical guidance. Oliver BenFounder — BenStrukt
Replies
1
Boosts
0
Views
77
Activity
2d
Apple T2: Public APIs for independent watchdog control and rollback-resistant application state?
Hello, I am developing a safety-critical, automated application on a MacBook Air (Retina, 13-inch, 2020, Intel) running macOS 15. I am investigating whether the Apple T2 Security Chip can provide a hardware-backed trust boundary independent of the host macOS kernel. I have reviewed Apple's Platform Security documentation and the public Security and CryptoKit APIs for Secure Enclave key protection. I would appreciate clarification on two specific questions: 1. Independent watchdog control Is there any public, supported API that allows a third-party macOS application to configure a hardware-backed watchdog that remains effective when the entire host macOS kernel becomes unresponsive? If so, can it enforce a bounded-time host reset or shutdown independently of host OS execution? 2. Rollback-resistant application state Does the T2 or its Secure Enclave expose a public, supported mechanism for maintaining an application-defined monotonic counter or small persistent state record that cannot be rolled back by restoring an older host filesystem or database snapshot on the same Mac? Specifically, I need to distinguish the latest committed application state from an older, previously valid state, including after a crash or reboot. I understand that hardware-backed signatures and non-exportable private keys alone do not necessarily establish state freshness or prevent replay of previously signed records. If neither capability is available through public, supported APIs on Intel-based T2 Macs, an explicit clarification would also be very helpful. I am not requesting private APIs, firmware modifications, reverse engineering, or changes to macOS security settings. Thank you for your technical guidance.
Replies
1
Boosts
0
Views
170
Activity
2d
Authentication-UI refusal for a file-based certificate query on macOS
The guidance in https://developer.apple.com/forums/thread/739774 explains the context search list, the kSecMatchSearchList override and continued use of deprecated file-based APIs where that keychain model is required. For a SecItemCopyMatching query using kSecClassCertificate and an explicitly supplied file-based test keychain, what is the supported way to refuse authentication UI rather than allow a prompt? I am considering macOS 26.6.1 with the macOS 27.0 SDK; please clarify applicability to that combination and any relevant application-context restrictions. In particular, which refusal mechanism applies to the file-based path given the deprecation of earlier authentication-UI options? If access would require keychain unlock or authentication UI, is an error guaranteed, or can the query omit items and return success? A public documentation reference and any version limitations would be helpful. This is a contract question for a prospective test; I have not run it or reproduced a problem.
Replies
1
Boosts
0
Views
126
Activity
2d
Supported per-operation fresh administrator authentication evidence in macOS
We are designing a macOS privileged helper for attended local administrative operations. Each operation must require a new native administrator authentication, separate protected confirmation of the exact operation, and durable single-use consumption. The app must never collect administrator passwords. A successful right evaluation or an existing administrative session alone is insufficient. In an isolated arm64 macOS VM (build 26B131), we tested a custom inert Authorization Services right with class=user, group=admin, authenticate-user=true, shared=false, timeout=0, allow-root=false. The noninteractive request was denied and cancellation was observed. A subsequent interactive request displayed a dialog without the expected custom prompt token; the test stopped without establishing positive exact consent. The temporary right has been removed. No privileged effect was performed. We reviewed ES_EVENT_TYPE_NOTIFY_AUTHENTICATION, ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_PETITION, and ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_JUDGEMENT and the corresponding SDK structures. Audit tokens identify processes, but we could not identify a documented per-evaluation correlation identifier joining a specific authentication event to a particular right evaluation. Is there a supported public API or documented policy contract that guarantees a fresh native administrator authentication (not a cached credential or an existing session) for a specific custom right evaluation? If so, how can the trusted helper verify freshness, the authenticated administrator identity or membership, and association with that particular evaluation, without handling credentials? Is there a supported causal identifier or documented correlation guarantee for the three Endpoint Security notifications, including concurrent requests and lost events? If an authorization plug-in or AuthorizationCopyInfo is relevant, what guarantees are documented for freshness and provenance of the data returned? If no such mechanism is supported, is there an Apple-recommended architecture meeting these requirements without weakening them? We are asking for API semantics and a supported design, not a workaround for security controls. We can provide a minimal inert reproducer if needed.
Replies
1
Boosts
0
Views
93
Activity
2d
Supported per-operation fresh administrator authentication evidence in macOS
We are designing a macOS privileged helper for attended local administrative operations. Each operation must require a new native administrator authentication, separate protected confirmation of the exact operation, and durable single-use consumption. The app must never collect administrator passwords. A successful right evaluation or an existing administrative session alone is insufficient. In an isolated arm64 macOS VM (build 26B131), we tested a custom inert Authorization Services right with class=user, group=admin, authenticate-user=true, shared=false, timeout=0, allow-root=false. The noninteractive request was denied and cancellation was observed. A subsequent interactive request displayed a dialog without the expected custom prompt token; the test stopped without establishing positive exact consent. The temporary right has been removed. No privileged effect was performed. We reviewed ES_EVENT_TYPE_NOTIFY_AUTHENTICATION, ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_PETITION, and ES_EVENT_TYPE_NOTIFY_AUTHORIZATION_JUDGEMENT and the corresponding SDK structures. Audit tokens identify processes, but we could not identify a documented per-evaluation correlation identifier joining a specific authentication event to a particular right evaluation. Is there a supported public API or documented policy contract that guarantees a fresh native administrator authentication (not a cached credential or an existing session) for a specific custom right evaluation? If so, how can the trusted helper verify freshness, the authenticated administrator identity or membership, and association with that particular evaluation, without handling credentials? Is there a supported causal identifier or documented correlation guarantee for the three Endpoint Security notifications, including concurrent requests and lost events? If an authorization plug-in or AuthorizationCopyInfo is relevant, what guarantees are documented for freshness and provenance of the data returned? If no such mechanism is supported, is there an Apple-recommended architecture meeting these requirements without weakening them? We are asking for API semantics and a supported design, not a workaround for security controls. We can provide a minimal inert reproducer if needed.
Replies
1
Boosts
0
Views
97
Activity
2d
APFS snapshots: documented guarantees for backing-storage identity and exclusion of non-root writers
We are developing MasterVault Clean Room, a governed data system whose validation gate evaluates recorded claims. Each successful validation must refer to one stable, identifiable input view, protected from capture through final consumption. We trust the macOS kernel and approved Apple storage stack, and are evaluating APFS snapshots as a candidate mechanism, but need to establish the backing-storage boundary before relying on them. 1. Binding the open file to its complete backing storage What supported interfaces let a process start with an open file descriptor on an APFS snapshot, identify its complete backing-storage chain, and reject disk-image-backed or other file-backed sources? We need to bind this evidence to the snapshot actually being read. A pathname, mount-point inspection, or independently obtained device identity is insufficient unless the supported semantics establish that binding and address changes during verification. If someone could identify the documented guarantees and limitations of any supported verification sequence, it would be emminently helpful. 2. Excluding non-root writable access through final consumption What supported mechanism or deployment configuration can establish that no non-root actor retains writable access to that backing storage, from capture through final consumption? This must account for: Writable disk-image files or other file-backed storage beneath the snapshot. Pre-existing writable raw/block-device handles. Aliases or alternate access paths to the same backing storage. Changes to the backing-storage configuration during that interval. A read-only snapshot mount and current ownership or device-permission checks alone do not establish this requirement: they do not demonstrate that previously acquired writable access is absent or has been revoked. What we need from the platform Please identify: The supported interfaces and their documented guarantees. Required privileges, supported macOS versions, and storage configurations. Deployment restrictions needed to establish and maintain the boundary. Any part of this requirement that cannot be established through supported public interfaces. We can restrict our supported deployment configurations where necessary, but those restrictions must have a documented basis. The general APFS overview explains features such as cloning, shared space, and sparse files. It does not answer these backing-storage identity and writer-exclusion questions. Likewise, describing snapshots as read-only does not by itself resolve whether their backing storage can be altered through another route. We are seeking platform semantics and supported mechanisms, not Apple certification of MasterVault. This information will determine our admission checks, supported configurations, and qualification tests. If the guarantee is unavailable—or cannot be substantiated for a particular configuration—our validation must remain unresolved, rather than report assurance we cannot support.
Replies
0
Boosts
0
Views
143
Activity
5d
Sandbox restriction blocks Keychain access during Live Activity rendering: supported design for encrypted updates?
Hi, I'm building a Live Activity prototype using fictitious data. I want incoming updates to stay encrypted until they reach my iPhone, without putting the decryption key in ActivityAttributes, ContentState, or archived views. My goal is timely updates without an alert for each change. I'm using Xcode 27.2 and the iPhoneOS 27.2 SDK. My iPhone was running iOS 27.2.1 when I last checked. I haven't recorded its exact OS build or the OS version and build for every earlier test. My app and WidgetKit extension have the same shared Keychain access group in their signed entitlements. My app creates a 32-byte test key as a generic password with kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, with synchronization disabled. The extension only reads the key. A failed lookup never causes the key to be replaced or deleted. When I try to read the key while rendering the Live Activity, the first, metadata-only SecItemCopyMatching call returns errSecNotAvailable (-25291). It fails before I request any secret bytes. I reproduced this after stopping and restarting the activity with my iPhone unlocked. I get the same result with a non-interactive LAContext and with kSecUseAuthenticationUIFail without a supplied context. I used the latter only for comparison, since it is deprecated. My query specifies the class, fixed service and account, and shared access group. It also sets kSecUseDataProtectionKeychain. For the metadata lookup, I use kSecAttrSynchronizableAny, kSecReturnAttributes: true, and kSecMatchLimitAll, without requesting data or item references. I only request the key bytes after finding exactly one item and validating its policy, so that second step is never reached here. For comparison, I added a regular widget to the same signed WidgetKit extension. Its timeline provider successfully validates the metadata using the same read-only query and client, while the Live Activity still returns errSecNotAvailable. I captured these results separately; I haven't established whether they ran simultaneously or in different processes. I have only confirmed metadata access in the regular widget, not access to the key bytes. I also tried decrypting in my foreground app and then passing the fictitious summary to ActivityKit through a local update. That renders correctly on my iPhone. It doesn't test remote delivery or background decryption, or fix the Keychain failure during rendering. I repeated the test with debug messages enabled in Console. The Live Activity in my diagnostic build still shows the same Keychain failure. The capture from the extension now includes the connection error, not just the generic securityd message: activating connection: ... name=com.apple.securityd failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159] invalidated after a failed init got event: Connection invalid Failed to talk to securityd after 4 attempts. error:[-25291] Error Domain=com.apple.security.xpc Code=3 Connection invalid - Connection init failed at lookup with error 159 - Sandbox restrictionThis excerpt omits connection addresses and account fields. The same -25291 error and sandbox-restriction reason appear five times in this capture. It establishes the reported reason for the connection failure in this test; I haven't established whether this is an intended restriction, an OS issue, or a configuration issue. I also don't infer the actual retry count from the generic message. I'd appreciate guidance on these questions: Given the explicit sandbox-restriction error for com.apple.securityd, is non-interactive Keychain access intentionally unavailable during Live Activity rendering, or should I investigate an OS or configuration issue? Displaying live data with Live Activities documents a separate sandbox and restrictions on network and location access, but I haven't found its Keychain access contract. How should I interpret the different result from my regular widget's timeline provider? For encrypted content-state updates, is there a supported execution point where my app can authenticate and decrypt each update before handing a local render value to ActivityKit? I found the documented app wake-up for push-to-start, but not an equivalent for ordinary updates. If neither approach is supported, how can I deliver timely, alert-free encrypted Live Activity updates while keeping the key solely in Keychain and out of archived state and views? How does ActivityKit protect static ActivityAttributes at rest? Can those attributes be included in backups or replicated to an Apple Watch or Mac, separately from rendered views? Does any of that data pass through Apple servers, and is there a public API to opt out of replication? Would a per-activity session key in locally created static attributes be a supported design, or does Apple advise against storing secrets there? I haven't implemented this alternative. I would keep the long-term pairing key in Keychain, exclude the session key from every APNs payload, and start the activity locally rather than through push-to-start. I'd like to understand the storage and replication guarantees before considering it further. I'm looking for a supported design without weakening Keychain protection, allowing authentication UI during rendering, or suppressing an ordinary notification to bypass its requirements. I can prepare a minimal reproducer with fictitious data and no tokens, real identifiers, or conversation content. Thanks for your help.
Replies
4
Boosts
0
Views
189
Activity
5d
CKKS zone deletions return success but stale 2019 key hierarchy persists; "Delete iCloud Data" not offered (FB25584356)
I filed FB25584356 for this and would appreciate any pointers. Setup: Mac mini on macOS 27.2.1 and an iPhone on iOS 27.2, same Apple Account, HSA2, Advanced Data Protection off. Octagon is healthy (otctl status = Ready, both devices trusted). Symptoms: AirDrop to my own iPhone fails when I pick the device (rapportd: "PairVerify server M2 failed: copy identity"), iPhone Mirroring ends with noCompatiblePhone, and various clients log CKErrorDomain 111 / 5009 "Keychain Sync Incomplete". What I see in CKKS: seven zones (AutoUnlock, LimitedPeersAllowed, Home, Manatee, ApplePay, Health, Engram) still hold a key hierarchy from August 2019. The only TLKShare was issued by a device that left the account years ago, so neither current device can unwrap the TLK ("No trusted TLKShares", CKKSErrorDomain 35). secd then does what I would expect: tlkmissing → "No other devices claim to have the TLK. Resetting zone..." → CKKSDeleteCKZoneOperation → local reset → zones recreated. The delete appears to succeed. With debug logging, cloudd shows status:200 and "RecordZone ... was successfully deleted from the server" for each zone. The next fetch returns the same 2019 records with an identical server change token. Over about 11 hours: 124 reset cycles, 869 zone deletions reported as successful, 182 consecutive AutoUnlock fetches with the same change token. When not throttled it runs roughly every 5 seconds; CloudKit eventually answers "Service Unavailable" (CKError 6/2009) with a ~59 minute retry-after, and all 23 zones are unusable in the meantime. ckksctl -v AutoUnlock reset-cloudkit behaves the same way. Reset path: Support article 120862 describes "Don't know passcode?" → "Forgot all passcodes?" → "More Options" → "Delete iCloud Data". With the Mac signed in but not yet trusted, "Don't know passcode?" only offered Cancel / Try Again Later, in the sign-in flow and in both System Settings follow-ups. After three wrong passcodes the alert had a single "Try Again Later" button, although cdpd logged "Creating recovery option: Reset". Questions: Is a client-side zone delete expected to be a no-op for these zones while the server reports success? Is there a supported way to reach performCKServerUnreadableDataRemoval / "Delete iCloud Data" when another trusted device exists? I am fine with losing the end-to-end encrypted data in those zones. Logs and a sysdiagnose are attached to the Feedback.
Replies
1
Boosts
0
Views
181
Activity
1w
Is JIT execution possible for ordinary third-party iOS apps?
I'm researching whether a normally signed third-party iOS application can use Just-In-Time (JIT) compilation on a stock, unjailbroken iPhone. My project, Kairavox, aims to run a genuine, unmodified iPadOS installation as a guest inside a native iOS application. JIT compilation is central to our intended execution architecture: we want to translate and execute guest AArch64 instructions through dynamically generated native code. We intend to test through personal development signing and sideloading using AltStore or SideStore. App Store distribution is not a requirement. I've found Apple's documentation for: Allow Execution of Just-In-Time (JIT) Compiled Code Entitlement Porting Just-In-Time Compilers to Apple Silicon Alternative Browser Engines in the European Union However, the first two appear to concern the macOS Hardened Runtime context. Apple's alternative browser engine provisions also describe a specifically authorized exception, which does not describe our application. I'd appreciate clarification on what is supported for an ordinary third-party iOS app: Is there a documented iOS API or entitlement that allows a normally signed third-party app to allocate writable memory, generate machine code, and execute that code at runtime? Does iOS support MAP_JIT for ordinary third-party applications, or is it restricted to other Apple platforms or specially authorized applications? Is com.apple.security.cs.allow-jit exclusively a macOS Hardened Runtime entitlement, or does it have any application on iOS? Can an app using free Personal Team development signing execute JIT-generated code? Does paid Apple Developer Program membership change this? Do development, ad hoc, or other signing arrangements differ in their JIT permissions? Is there a documented process for an independent developer to request the necessary capability? Does installing an app through AltStore or SideStore change its OS-granted executable-memory permissions, or does it retain the permissions associated with its signed build? Are there any documented restrictions on using JIT-generated native code for CPU emulation or virtualization workloads? I understand that Apple's EU alternative-browser-engine authorization is a narrow exception for eligible browser applications. I'm not assuming it applies to Kairavox. The main question is whether an independent developer can build and test a JIT-based application on a stock iPhone using an officially supported signing and permission model. Thank you.
Replies
1
Boosts
0
Views
126
Activity
1w
macOS APFS: com.apple.macl and UF_TRACKED appear after creating a hard link — safe file replacement and rollback?
I'm investigating an unexpected metadata change during a controlled file deployment on macOS. Environment and observed state Two regular configuration files are used by a local service. Before replacement, the first file had: SHA-256: verified. File flags: 0. Extended attributes: none. Hard-link count: 1. Owner/group: 501/20. Permissions: 0644. ACL: empty. A backup procedure created a hard link to preserve the original inode before replacing the active pathname with an independently created file. Immediately after creating and verifying the hard link, the original file was observed with: The same SHA-256 and inode. Flags: 64 (UF_TRACKED). Extended attribute: com.apple.macl. Hard-link count: 2. No file content was replaced. The procedure stopped because the metadata no longer matched the original baseline. Additional observations Other backup methods also encountered unexpected metadata changes during destination creation. Tests using renamex_np with RENAME_SWAP successfully exchanged and restored artificial files with flags 0 and empty extended attributes. A test with artificial files already containing com.apple.provenance also succeeded. We could not reproduce the specific UF_TRACKED + com.apple.macl + two-hard-link state in an isolated fixture using ordinary documented operations. The operational original and its second hard link currently share the same inode. No attempt has been made to remove the protected attribute or change its flags. Questions for Apple filesystem/security specialists Under what documented circumstances can creating a hard link or related Finder/TCC document-tracking behavior cause UF_TRACKED and com.apple.macl to appear on an existing file? Are these metadata changes expected for a file accessed through a user-authorized Documents location? What supported mechanism can preserve the current original inode and provide a verifiable rollback when replacing its active pathname? Is renamex_np(..., RENAME_SWAP) appropriate for this situation, and what special considerations apply to the existing second hard link and protected extended attributes? What verification criteria would you recommend before permitting a production replacement? I am looking for a documented, reversible procedure that preserves macOS security protections. I do not want to disable SIP, forcibly remove com.apple.macl, or bypass TCC. I can provide sanitized metadata comparisons and a minimal reproduction if needed.
Replies
1
Boosts
0
Views
178
Activity
1w
Client identity selection and chain presentation when an intermediate CA in the identity’s chain is revoked
We deploy client-authentication identities (certificate + private key) to iOS/iPadOS devices for mutual TLS and Wi-Fi EAP-TLS. The identities are installed via MDM configuration profiles and used from Safari, from our app via URLSession client certificate challenges, and by the system for EAP-TLS. The intermediate CA certificate in these identities’ chain (issued by a publicly trusted root) will be revoked. A replacement intermediate certificate with the same subject and public key, but a different serial number, is valid, and the end-entity certificates will not be reissued. The private keys are not exportable. If the revoked intermediate is known to the device through Apple’s distributed revocation data, or only through the root CA’s CRL, does iOS/iPadOS evaluate this when offering the identity for selection in Safari, when handling a URLSession client certificate challenge, or when using it for EAP-TLS? Could the identity be hidden, flagged, or fail to be presented? If we install the replacement intermediate on the device (e.g. via a certificate payload in a configuration profile) and remove the original, will the system build and present the chain through the replacement certificate? For URLSession, if our app supplies the chain explicitly in URLCredential(identity:certificates:persistence:), is any revocation evaluation performed on that chain on the client side? The revocation is scheduled for 2026-11-20T09:00:00Z. Our users rely on this system for patient care in medical institutions, so any guidance before then would be greatly appreciated.
Replies
2
Boosts
5
Views
594
Activity
2w
macOS 27/APFS: Supported ACL Absence Verification When acl_get_fd_np Returns ENOENT
Subject: Supported fail-closed ACL absence verification on macOS 27.0.1 / APFS Environment: macOS 27.0.1, build 26A434; APFS; installed macOS 27.0 SDK. We need a supported, documented way to determine whether an existing filesystem object has no effective ACL entries, while rejecting genuine retrieval failures and unsupported or unavailable ACL evidence. We are seeking clarification of the public interface contract, not alleging an Apple defect. For existing directory and regular-file fixtures, pathname metadata and descriptor metadata identify the same object. Errno is cleared immediately before each native call and captured immediately afterward. ACL retrieval uses ACL_TYPE_EXTENDED: acl_get_file(path, ACL_TYPE_EXTENDED) acl_get_fd_np(fd, ACL_TYPE_EXTENDED) On fresh objects, both return NULL with ENOENT. Explicit one-entry fixture ACLs are retrieved successfully. Explicit zero-entry fixture ACLs can also yield NULL/ENOENT, while attribute queries return a serialized zero-entry ACL. The attribute queries use getattrlist() and descriptor-bound fgetattrlist(), requesting ATTR_CMN_RETURNED_ATTRS | ATTR_CMN_EXTENDED_SECURITY, with FSOPT_NOFOLLOW | FSOPT_REPORT_FULLSIZE and WITHOUT FSOPT_PACK_INVAL_ATTRS. Buffer lengths, variable-reference bounds and returned-attribute validity are checked. For the existing directories of interest, both calls succeed but omit the ATTR_CMN_EXTENDED_SECURITY returned bit. Explicit populated and zero-entry fixture records do set the bit. APFS reports valid VOL_CAP_INT_EXTENDED_SECURITY support; we do not assume that volume capability proves per-object ACL availability. On macOS 27.0.1, build 26A434, using APFS, which supported interface and documented conditions allow software to distinguish an absent ACL from unavailable or unsupported ACL evidence when descriptor-bound attribute queries succeed but omit ATTR_CMN_EXTENDED_SECURITY and native ACL getters return ENOENT for an existing object? Please clarify: Whether ENOENT has a supported ACL-absence interpretation, and under exactly which checked conditions. Whether an omitted extended-security attribute can establish ACL absence, rather than unavailable or unsupported evidence. How explicit zero-entry ACLs differ from absent ACL records through supported interfaces. How KAUTH_FILESEC_NOACL should be interpreted through supported APIs. How genuine retrieval failures, including permission, I/O, allocation and unsupported-operation errors, must remain distinguishable. Whether a supported descriptor-bound verification method exists that preserves fail-closed security checks and object identity binding; please identify its guarantees and limitations regarding pathname/ancestor changes and later operations. Whether relevant behavior is specific to this macOS/APFS version. Please identify the applicable public documentation or supported verification sequence. We do not want to modify permissions, synthesize ACLs on target objects, treat invalid-attribute defaults as real evidence, or accept ambiguous omission/ENOENT as success. Existing ownership, mode and confinement checks must remain separate mandatory checks. If no public API can make this distinction reliably, please state that limitation.
Replies
15
Boosts
0
Views
623
Activity
2w
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
219
Activity
2w
Choosing a TLS server identity by client address with NWListener
I run an HTTPS server on NWListener (iOS and macOS) that serves several identities from one listener on port 443, picked per handshake in sec_protocol_options_set_challenge_block, as suggested in this thread. That works well for every handshake that carries a server name. The trouble is handshakes without one. Clients on the LAN connect by IP address, so they send no SNI (RFC 6066 keeps IP literals out of it), and they trust a self-signed certificate through a configuration profile. Internet clients and scanners that reach the public address through the router's port forward also often arrive without SNI. The two groups should get different certificates, and the only thing that tells them apart is the client's address. The listener knows it in newConnectionHandler, but the challenge block never sees it. What I tried: sec_protocol_metadata_t has accessors for the server name, ALPN, version, cipher suite and so on, but I can't find one for the connection's endpoints. Setting a challenge block on the accepted connection's own TLS options before start(): listener.newConnectionHandler = { connection in let remote = connection.endpoint if let tls = connection.parameters.defaultProtocolStack.applicationProtocols .compactMap({ $0 as? NWProtocolTLS.Options }).first { sec_protocol_options_set_challenge_block(tls.securityProtocolOptions, { _, complete in complete(identity(for: remote)) }, queue) } connection.start(queue: queue) }This block never runs. The listener's own block answers every handshake (tested on macOS 27.2). My questions: Is there a supported way to choose the server identity per connection based on its endpoints, short of terminating TLS myself? Is the challenge block supported under TLS 1.3 by now? I also see it run twice for every handshake; is that expected? When a server-side handshake fails, connection.metadata(definition: NWProtocolTLS.definition) returns nil. Is there any way to learn which server name a failed handshake asked for, so it can be logged? I filed FB25541009 with a small sample project that shows all three.
Replies
2
Boosts
0
Views
115
Activity
2w