Running shortcuts with Process.run is broken on MacOS Ventura 13.2

Our application uses shortcuts to automate some tasks with other applications, we have two version, a sandboxed one, and a more powerfull application with no sandbox.

Our solution was working well on Sandboxed or not sandboxed apps before Ventura 13.2.

With Ventura 13.2, the not sandboxed application is not working anymore, except if we give "Full Disk" access to our software. 

To run the shortcut, we simply use the shortcuts executable.

    let process = Process()
    let outputDir = outputFile.deletingLastPathComponent()
    process.executableURL = URL(fileURLWithPath: "/usr/bin/shortcuts")

    process.arguments = [
        "run",
        "Zip Shortcut",
        "--input-path",
        inputFile.path,
        "--output-path",
        outputFile.path
    ]

    let outputPipe = Pipe()
    let errorPipe = Pipe()
    process.standardOutput = outputPipe
    process.standardError = errorPipe

    do {

        try process.run()

    } catch { ....

We we try to execute a simple shortcut (a shorcut that zip the file for example), we have this error message :

open on /Users/hlemai/Library/Shortcuts/Temporary/com.apple.shortcuts.ShortcutsCommandLine/129FFC94-FE02-493D-8192-7AA6CD5BE928: Operation not permitted

We want to avoid our user to provide a full Disk access, but it seems that the mecanism used in our sandboxed app (using Security Bookmark) is not working on the not sandboxed one.

Is it possible to used the same mecanism storing security bookmark (with "com.apple.security.files.bookmarks.app-scope" entitlement) ?

If you remove any extra permissions from Terminal and then run the same shortcuts command from there, does it also fail?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yes, it is!

When I remove Full Disk access to Terminal App, the shortcuts command line fail with no error message.

with FullDisk access:

% ls ~/tmp/Export/*.zip
zsh: no matches found: /Users/hlemai/tmp/Export/*.zip
% shortcuts run "Zip Shortcut" --input-path ~/tmp/Export/IMG_1520.jpeg --output-path ~/tmp/Export/IMG_1520.jpeg.zip
% ls ~/tmp/Export/*.zip                                                                                            
/Users/hlemai/tmp/Export/IMG_1520.jpeg.zip

without:

% ls ~/tmp/Export/*.zip 
zsh: no matches found: /Users/hlemai/tmp/Export/*.zip
% shortcuts run "Zip Shortcut" --input-path ~/tmp/Export/IMG_1520.jpeg --output-path ~/tmp/Export/IMG_1520.jpeg.zip
% ls ~/tmp/Export/*.zip                                                                                            
zsh: no matches found: /Users/hlemai/tmp/Export/*.zip

Yes it have the same behavior, i post an example below.

Running shortcuts with Process.run is broken on MacOS Ventura 13.2
 
 
Q