Sandbox - security scoped URL - MacOS

In a MacOS App:
  • When I create a file (in a folder), I save a security bookmark for the file.

  • if I ask user to authorise its folder (before creating the file in it), I can save its bookmark too, allowing to create other files in this folder.

So, when I create a file and need to create a companion (eg, a Results file), I first ask access to the folder, then create the file and create the results file in the same folder (hence having sandbox authorisation).

My understanding is that it is not possible to programmatically create and save the folder bookmark, after deriving its url from the file url, without requesting user to explicitly grant access (with NSOpen panel) ? Which would be very logical as it would deny the goal of security bookmarks.
So, is user explicit authorisation required (logical but creates more complexity when user moves files in the Finder).

Note: In fact don't really need it, as I save bookmark for every accessed file, but I would like to know.
Answered by Claude31 in 672090022
I come to the conclusion it cannot be done programmatically, as it would allow app to access any folder, without user authorisation. Antinomic to sandboxing.
Accepted Answer
I come to the conclusion it cannot be done programmatically, as it would allow app to access any folder, without user authorisation. Antinomic to sandboxing.
Sandbox - security scoped URL - MacOS
 
 
Q