Run third part apps with argument from macOS sandbox

Hello

I'm trying to make one of our internal app compliant with App Store rules for public release.

The app is a custom Firefox launcher, that will be used to easily manage Firefox profile.

Which mean part of the code will start Firefox with specifics args. And that's the part that does not fit well in the sandbox.

What's the correct way to refactor the following code to be sandbox compatible?

     let command = Process()
    command.executableURL = URL(fileURLWithPath: "/usr/bin/open")
    command.arguments = ["-n", "-a", "/Applications/Firefox.app", "--args", "--no-remote", "-P", name]
    try? command.run()

Right now with this code, Firefox open, but behave improperly, like if it was started from my own sandbox and could not load the selected profile.

If I switch to NSWorkspace, the behavior is the same.

Answered by DTS Engineer in 698967022

Which mean part of the code will start Firefox with specifics args. And that's the part that does not fit well in the sandbox.

Correct. There’s no way for a sandboxed app to supply arguments when launching another app. This is a deliberate security restriction.

Share and Enjoy

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

Accepted Answer

Which mean part of the code will start Firefox with specifics args. And that's the part that does not fit well in the sandbox.

Correct. There’s no way for a sandboxed app to supply arguments when launching another app. This is a deliberate security restriction.

Share and Enjoy

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

Run third part apps with argument from macOS sandbox
 
 
Q