Hi. We're writing Authorization Plugin and started with NullAuthPlugin compilation. When tried to run it on VM (Sonoma 14.6, SIP enabled), we're going into the following issue:
`2025-03-08 13:38:20.699503-0800 0xdcb0 Error 0x0 0 0 kernel: (AppleMobileFileIntegrity) [com.apple.MobileFileIntegrity:library_validation_failure] Library Validation failed: Rejecting '/Library/Security/SecurityAgentPlugins/NullAuthPlugin.bundle/Contents/MacOS/NullAuthPlugin' (Team ID: ABCD12EF34, platform: no) for process 'SecurityAgentHel(2094)' (Team ID: N/A, platform: yes), reason: mapping process is a platform binary, but mapped file is not'
As I understand, the platform binary is the one signed with Apple signature, which indeed is unavailable for us.
How can we avoid this issue and run the plugin? Perhaps we're missing some build setting requirement?
Prioritize user privacy and data security in your app. Discuss best practices for data handling, user consent, and security measures to protect user information.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello!
I do know apple does not support electron, but I do not think this is an electron related issue, rather something I am doing wrong. I'd be curious to find out why the keychain login is happenning after my app has been signed with the bundleid, entitlements, and provision profile.
Before using the provision profile I did not have this issue, but it is needed for assessments feature.
I'm trying to ship an Electron / macOS desktop app that must run inside Automatic Assessment Configuration. The build signs and notarizes successfully, and assessment mode itself starts on Apple-arm64 machines, but every single launch shows the system dialog that asks to allow access to the "login" keychain. The dialog appears on totally fresh user accounts, so it's not tied to anything I store there.
It has happened ever since I have added the provision profile to the electron builder to finally test assessment out.
entitlements.inherit.plist keys
<key>com.apple.security.cs.allow-jit</key> <true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/>
entitlements.plist keys:
<key>com.apple.security.cs.allow-jit</key> <true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/>
<key>com.apple.developer.automatic-assessment-configuration</key> <true/>
I'm honestly not sure whether the keychain is expected, but I have tried a lot of entitlement combinations to get rid of It. Electron builder is doing the signing, and we manually use the notary tool to notarize but probably irrelevant.
mac: {
notarize: false,
target: 'dir',
entitlements: 'buildResources/entitlements.mac.plist',
provisioningProfile: 'buildResources/xyu.provisionprofile',
entitlementsInherit: 'buildResources/entitlements.mac.inherit.plist',
Any lead is welcome!
Topic:
Privacy & Security
SubTopic:
General
Tags:
Automatic Assessment Configuration
Assessment
Security
Entitlements
Hi all,
I'm using a CryptoTokenKit (CTK) extension to perform code signing without having the private key stored on my laptop. The extension currently only supports the rsaSignatureDigestPKCS1v15SHA256 algorithm:
func tokenSession(_ session: TKTokenSession, supports operation: TKTokenOperation, keyObjectID: TKToken.ObjectID, algorithm: TKTokenKeyAlgorithm) -> Bool {
return algorithm.isAlgorithm(SecKeyAlgorithm.rsaSignatureDigestPKCS1v15SHA256)
}
This setup works perfectly with codesign, and signing completes without any issues.
However, when I try to use productsign, the system correctly detects and delegates signing to my CTK extension, but it seems to always request rsaSignatureDigestPKCS1v15SHA1 instead:
productsign --timestamp --sign <identity> unsigned.pkg signed.pkg
productsign: using timestamp authority for signature
productsign: signing product with identity "Developer ID Installer: <org> (<team>)" from keychain (null)
...
Error Domain=NSOSStatusErrorDomain Code=-50
"algid:sign:RSA:digest-PKCS1v15:SHA1: algorithm not supported by the key"
...
productsign: error: Failed to sign the product.
From what I understand, older versions of macOS used SHA1 for code signing, but codesign has since moved to SHA256 (at least when legacy compatibility isn't a concern). Oddly, productsign still seems to default to SHA1, even in 2025.
Is there a known way to force productsign to use SHA256 instead of SHA1 for the signature digest algorithm? Or is there some flag or configuration I'm missing?
Thanks in advance!
Hi everyone,
I’d like to clarify something regarding the behavior of Team IDs after an app transfer between Apple Developer accounts.
I have an app update that enforces a force update for all users. My plan is to release this update under the current developer account, and then proceed with transferring the app to a different developer account shortly afterward.
My concern is: once the transfer is complete, will users who download the same app version (released before the transfer) be logged out due to a change in Team ID? Specifically, does the transferred app continue to use the original Team ID (used to sign the last submitted build), or does the Team ID change immediately upon transfer — affecting Keychain access?
Any insights or confirmation on this would be greatly appreciated. Thanks!
Topic:
Privacy & Security
SubTopic:
General
First, I do not publish my application to the AppStore, but I need to customize a sandbox environment. It seems that sandbox-exec cannot configure entitlements, so I have used some other APIs, such as sandbox_compile_entitlements and sandbox_apply_container. When encountering the entitlement "com.apple.security.files.user-selected.read-only", I am unsure how to correctly write sandbox profile to implement this. Can anyone help me?
Having trouble decrypting a string using an encryption key and an IV.
var key: String
var iv: String
func decryptData(_ encryptedText: String) -> String?
{
if let textData = Data(base64Encoded: iv + encryptedText) {
do {
let sealedBox = try AES.GCM.SealedBox(combined: textData)
let key = SymmetricKey(data: key.data(using: .utf8)!)
let decryptedData = try AES.GCM.open(sealedBox, using: key)
return String(data: decryptedData, encoding: .utf8)
} catch {
print("Decryption failed: \(error)")
return nil
}
}
return nil
}
Proper coding choices aside (I'm just trying anything at this point,) the main problem is opening the SealedBox. If I go to an online decryption site, I can paste in my encrypted text, the encryption key, and the IV as plain text and I can encrypt and decrypt just fine.
But I can't seem to get the right combo in my Swift code. I don't have a "tag" even though I'm using the combined option. How can I make this work when all I will be receiving is the encrypted text, the encryption key, and the IV. (the encryption key is 256 bits)
Try an AES site with a key of 32 digits and an IV of 16 digits and text of your choice. Use the encrypted version of the text and then the key and IV in my code and you'll see the problem. I can make the SealedBox but I can't open it to get the decrypted data. So I'm not combining the right things the right way. Anyone notice the problem?
Topic:
Privacy & Security
SubTopic:
General
We have a macOS app that has a Photos Extension, which shares documents with the app via an app group container. Historically we used to have an iOS-style group identifier (group.${TeamIdentifier}${groupName}), because we were lead by the web interface in the developer portal to believe this to be the right way to name groups.
Later with the first macOS 15 betas last year there was a bug with the operating system warning users, our app would access data from different apps, but it was our own app group container directory.
Therefore we added a macOS-style group identifier (${TeamIdentifier}${groupName}) and wrote a migration of documents to the new group container directory.
So basically we need to have access to these two app group containers for the foreseeable future.
Now with the introduction of iOS-style group identifiers for macOS, Xcode Cloud no longer archives our app for TestFlight or AppStore, because it complains:
ITMS-90286: Invalid code signing entitlements - Your application bundle’s signature contains code signing entitlements that aren’t supported on macOS. Specifically, the “[group.${TeamIdentifier}${groupName}, ${TeamIdentifier}${groupName}]” value for the com.apple.security.application-groups key in isn’t supported. This value should be a string or an array of strings, where each string is the “group” value or your Team ID, followed by a dot (“.”), followed by the group name. If you're using the “group” prefix, verify that the provisioning profile used to sign the app contains the com.apple.security.application-groups entitlement and its associated value(s).
We have included the iOS-style group identifier in the provisioning profile, generated automatically, but can't do the same for the macOS-style group identifier, because the web interface only accepts identifiers starting with "group".
How can we get Xcode Cloud to archive our app again using both group identifiers?
Thanks in advance
Trying to validate external reference identifiers with SecTrustEvaluateWithError Method by setting reference Ids to SecPolicyCreateSSL() & SecPolicyCreateWithProperties()
But two concerns are -
Validates for correct reference IDs but gives error for combination of wrong & correct reference Ids
398 days validity works mandatorily before reference Ids check.
Is there any other to validate external reference Ids?, which give flexibility
To pass multiple combinations of reference IDs string (wrong, correct, IP, DNS)
To validate reference ID without days validity of 398.
Please suggest. Any help here is highly appreciated.
Hi everyone,
I’m working on an iOS app that uses biometric authentication to access secure keychain items and private keys stored in the Secure Enclave with some data encryption/decryption with those keys. My goal is to minimize the number of biometric prompts by reusing the authentication result within a short time window.
I have the following setup:
When writing the biometry-restricted keychain items and Secure Enclave keys, I use LAContext with the property LATouchIDAuthenticationMaximumAllowableReuseDuration = 1 minute, and I pass this context as the kSecUseAuthenticationContext field in the query.
When retrieving these items later (in a synchronous sequence upon app launch), I pass the same instance of LAContext as the kSecUseAuthenticationContext field.
The issue:
If I unlock my device and the biometric reuse time has not expired (i.e., less than 1 minute), the first two actions (keychain item retrieval and Secure Enclave key retrieval) do not prompt for Face ID.
However, when I attempt to decrypt data with the private key using SecKeyCreateDecryptedData, I’m prompted for Face ID even if the biometric reuse time is still valid.
If the biometric reuse time has expired (more than 1 minute since last authentication), I get prompted for Face ID on the first action (keychain retrieval), and subsequent actions (including data decryption) reuse that biometric result.
Question:
Does this behavior mean that SecKeyCreateDecryptedData ignore the LATouchIDAuthenticationMaximumAllowableReuseDuration property of LAContext, causing an additional biometric prompt during decryption with the private key? Or is there another reason for this behavior? Is there a way to make the biometric result reusable across all these actions, including decryption?
Thank you!
I work for Brave, a browser with ~80M users. We want to introduce a new system for automatic updates called Omaha 4 (O4). It's the same system that powers automatic updates in Chrome.
O4 runs as a separate application on users' systems. For Chrome, this works as follows: An app called GoogleUpdater.app regularly checks for updates in the background. When a new version is found, then GoogleUpdater.app installs it into Chrome's installation directory /Applications/Google Chrome.app.
But consider what this means: A separate application, GoogleUpdater.app, is able to modify Google Chrome.app.
This is especially surprising because, for example, the built-in Terminal.app is not able to modify Google Chrome.app. Here's how you can check this for yourself:
(Re-)install Chrome with its DMG installer.
Run the following command in Terminal: mkdir /Applications/Google\ Chrome.app/test. This works.
Undo the command: rm -rf /Applications/Google\ Chrome.app/test
Start Chrome and close it again.
mkdir /Applications/Google\ Chrome.app/test now fails with "Operation not permitted".
(These steps assume that Terminal does not have Full Disk Access and System Integrity Protection is enabled.)
In other words, once Chrome was started at least once, another application (Terminal in this case) is no longer allowed to modify it.
But at the same time, GoogleUpdater.app is able to modify Chrome. It regularly applies updates to the browser. For each update, this process begins with an mkdir call similarly to the one shown above.
How is this possible? What is it in macOS that lets GoogleUpdater.app modify Chrome, but not another app such as Terminal? Note that Terminal is not sandboxed.
I've checked that it's not related to codesigning or notarization issues. In our case, the main application (Brave) and the updater (BraveUpdater) are signed and notarized with the same certificate and have equivalent requirements, entitlements and provisioning profiles as Chrome and GoogleUpdater.
The error that shows up in the Console for the disallowed mkdir call is:
kernel (Sandbox)
System Policy: mkdir(8917) deny(1) file-write-create /Applications/Google Chrome.app/foo
(It's a similar error when BraveUpdater tries to install a new version into /Applications/Brave Browser.app.)
The error goes away when I disable System Integrity Protection. But of course, we cannot ask users to do that.
Any help would be greatly appreciated.
Hello,
We are working on integrating app integrity verification into our service application, following Apple's App Attest and DeviceCheck guide.
Our server issues a challenge to the client, which then sends the challenge, attestation, and keyId in CBOR format to Apple's App Attest server for verification. However, we are unable to reach both https://attest.apple.com and https://attest.development.apple.com due to network issues.
These attempts have been made from both our internal corporate network and mobile hotspot environments. Despite adjusting DNS settings and other configurations, the issue persists.
Are there alternative methods or solutions to address this problem? Any recommended network configurations or guidelines to successfully connect to Apple's App Attest servers would be greatly appreciated.
Thank you.
I'm trying to develop a GUI app on macOS that takes control of the screen so that user must perform certain actions before regaining control of the desktop. I don't want the user to be able to kill the process (for example via an "assassin" shell script that looks for the process and terminates it with kill).
Based on this post it is not possible to create an unkillable process on macOS.
I'm wondering, however, if it's possible to run the GUI process in root (or with other escalated privileges) such that the logged in user cannot kill it. So it's killable, but you need privileges above what the logged in user has (assuming they are not root). I'm not worried about a root user being able to kill it.
Such an app would run in a managed context. I've played around with Service Background Tasks, but so far haven't found what I'm looking for.
I'm hoping someone (especially from Apple) might be able to tell me if this goal is even achievable with macOS Sequoia (and beyond).
For security reasons, my application needs to prohibit external devices. If it is determined that the current phone is connected to any external devices, including non MFI authenticated devices, the app will exit. Please tell me how to do it? Thanks for your help.
Hi,
I am working on a react native module used for tis connection and I am trying to implement the possibility to use a custom certificate/Private key.
I have already implemented on android but on iOS I am getting hard times, we cannot find lots of resources, api is different on macOS and iOS with subtle differences so after having tested SO, chatgpt, ... I am trying here:
I even tried to use an internal api since it seems ffmpeg uses it but with no success.
I have attached my current code because it does not fit here.
to sump up after having inserted cert and private key I try to get a SecIdentityRef but it fails. I assume that it's not enough to simply add certain and private key...
// Query for the identity with correct attributes
NSDictionary *identityQuery = @{
(__bridge id)kSecClass: (__bridge id)kSecClassIdentity,
(__bridge id)kSecMatchLimit: (__bridge id)kSecMatchLimitOne,
(__bridge id)kSecReturnRef: @YES,
(__bridge id)kSecReturnData: @YES,
(__bridge id)kSecAttrLabel: @"My Certificate",
//(__bridge id)kSecUseDataProtectionKeychain: @YES
};
SecIdentityRef identity = NULL;
status = SecItemCopyMatching((__bridge CFDictionaryRef)identityQuery, (CFTypeRef *)&identity);
TcpSocketClient.txt
SecItemCopyMatching with kSecClassIdentity fails,
SecIdentityCreate return NULL...
So please help and indicates what I am doing wrong and how I am supposed getting a SecIdentityRef.
Thanks
Hi,
We use the iOS Keychain in our mobile app to securely store and retrieve data, which is tightly coupled with the initialization of some app features within the application.
This issue is encountered during app launch
We retrieve during Splash Screen UI controller at viewDidApper()
The logic we use to access the Keychain is as follows:
NSDate *NSDate_CD;
NSString *account = [NSString stringWithUTF8String:@"SOME_KEY_ACCOUNT"];
NSString *attrgen = [NSString stringWithUTF8String:@"SOME_KEY"];
NSMutableDictionary *query = [[NSMutableDictionary alloc] init];
[query setObject:(__bridge id)(kSecClassGenericPassword) forKey:(__bridge id<NSCopying>)(kSecClass)];
[query setObject:attrgen forKey:(__bridge id<NSCopying>)(kSecAttrGeneric)];
[query setObject:(__bridge id)(kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly) forKey:(__bridge id<NSCopying>)(kSecAttrAccessible)];
[query setObject: [NSBundle mainBundle].bundleIdentifier forKey:(__bridge id<NSCopying>)(kSecAttrService)];
[query setObject:account forKey:(__bridge id<NSCopying>)(kSecAttrAccount)];
[query setObject:@YES forKey:(__bridge id<NSCopying>)(kSecReturnAttributes)];
[query setObject:@YES forKey:(__bridge id<NSCopying>)(kSecReturnData)];
CFDictionaryRef valueAttributes = NULL;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&valueAttributes);
NSDictionary *attributes = (__bridge_transfer NSDictionary *)valueAttributes;
if(status==errSecSuccess) {
NSDate_CD = [attributes objectForKey:(__bridge id)kSecAttrCreationDate];
} else {
NSLog(@"Key chain query failed");
}
However, some users have reported intermittent failures during app launch. Upon investigation, we discovered that these failures are caused by exceptions thrown by the iOS Keychain, which the app is currently not handling. Unfortunately, we do not log the exception or the Keychain error code in the app logs at the moment, but we plan to implement this logging feature in the near future. For now, we are trying to better understand the nature of these errors.
Could you help clarify the following Keychain errors, which might be encountered from the code above?
errSecServiceNotAvailable (-25307)
errSecAllocate (-108)
errSecNotAvailable (-25291)
If these errors are encountered, are they typically persistent or are they temporary states that could resolve on their own?
Your insights would be greatly appreciated.
Thank you.
Hi,
I am using CryptoKit in my app. I am getting an error sometimes with some users. I log the description to Firebase but I am not sure what is it exactly about.
CryptoKit.CryptoKitError error 2
CryptoKit.CryptoKitError error 3
I receive both of these errors. I also save debug prints to a log file and let users share them with me. Logs are line-by-line encrypted but after getting these errors in the app also decryption of log files doesn't work and it throws these errors too.
I couldn't reproduce the same error by myself, and I can't reach the user's logs so I am a little blind about what triggers this.
It would be helpful to understand what these errors mean.
Thanks
In our application, we store user information (Username, Password, accessToken, Refresh token, etc.) in the keychain. However, after performing a hard reboot (unplugging and plugging back in), when we attempt to retrieve the ‘refresh token’ or ‘access token’ from the keychain, we receive the old token instead of the newly saved one.
I'm building a tool for admins in the enterprise context. The app needs to do some things as root, such as executing a script.
I was hoping to implement a workflow where the user clicks a button, then will be shown the authentication prompt, enter the credentials and then execute the desired action. However, I couldn't find a way to implement this. AuthorizationExecuteWithPrivileges looked promising, but that's deprecated since 10.7.
I've now tried to use a launch daemon that's contained in the app bundle with XPC, but that seems overly complicated and has several downsides (daemon with global machservice and the approval of a launch daemon suggests to the user that something's always running in the background). Also I'd like to stream the output of the executed scripts in real time back to the UI which seems very complicated to implement in this fashion.
Is there a better way to enable an app to perform authorized privilege escalation for certain actions? What about privileged helper tools? I couldn't find any documentation about them. I know privilege escalation is not allowed in the App Store, but that's not relevant for us.
I am developing a MacOS Authorisation Plugin, I have username and password entry items and utilising SFAuthorizationPluginView to display that. I am able to do so.
Requirement is I have to store ed25519 private key in PEM format in System Keychain as I need to read this entry before login to sign a request to a remote server.
I only want my authorisation plugin to access this private key in System Keychain.
I am looking up resources on the internet but I could not find specific to macOS Authorisation plugin, many are specific to iOS and some point at using entitlements and app group, but I doubt that applies to macOS authorisation plugin.
I'll really appreciate if some pointers are shared how can I store a private credential in System Keychain so that it can be used by only my plugin only, and this is before I have logged into the system.
I am developing an Authorization plugin for macOS that should be invoked when a user unlocks their device from the lock screen. Based on advice from the other threads in these forums, I have understood that:
The plugin needs to use SFAuthorizationPluginView
The auth db entries to modify are system.login.screensaver and authenticate
I found the NameAndPassword sample and after making some tweaks to it was able to get it to work from screensaver unlock.
I am trying to add Webview-based authentication to the plugin, but have not had any success. The plugin window's width does not change (though the height does) and only a small portion of the HTML gets rendered. Is Webview-based authentication supported with SFAuthorizationPluginView? Are there any alternatives?