I am trying to open a cocoa GUI application from authorization plugin which runs during login. I have placed the application in /Library/Application Support/MyFolder/Example.app. I am using below environment and code to open the application.
Environment:
OSX: 10.14.5 (Mojave)
Xcode: 11.2.1
Swift: 4.2
Code:
let task = Process.init()
task.launchPath = "/Library/Application Support/MyFolder/Example.app/Contents/MacOS/Example"
task.arguments = ["Hi", "Hello"]
task.launch()
task.waitUntilExit()
While the above code works perfectly fine when trying to open process from normal cocoa application it doesn't when I am trying the same from a bundle project which is used as an authorization plugin (https://developer.apple.com/documentation/security/authorization_plug-ins/using_authorization_plug-ins)
Crash Report:
Process: Example [2236]
Path: /Library/Application Support/MyFolder/Example.app/Contents/MacOS/Example
Identifier: com.MyFolder.mfa1.Example
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: SecurityAgent [2223]
Responsible: Example [2236]
User ID: 92
Date/Time: 2020-03-23 01:23:26.652 +0530
OS Version: Mac OS X 10.14.5 (18F132)
Report Version: 12
Bridge OS Version: 3.5 (16P5125)
Anonymous UUID: 42E41D19-877E-2567-CBFA-B03BAF4D4DE8
Time Awake Since Boot: 8800 seconds
System Integrity Protection: enabled
Crashed Thread: 1 Dispatch queue: com.apple.root.default-qos
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [2236]
Application Specific Information:
XPC API Misuse: Attempt to look up cross UID boundaries by unprivileged process.
Application Specific Signatures:
API Misuse
For full crash report look at the https://pastebin.com/ZtRrpMFe