Sharing settings between processes and users

Hi everybody, what is recommended way to share settings (user defaults or any other way of storing preferences) between different processes with different ownership? For example we have a UI app, which runs from user, daemon and system extension which both run from root. How can we do some configuration on user level and read it in daemon/system extension safely, without providing some exploits.

Bonus: how to observe changes in this scenario?

IMO the best way to do this is to have one of your global processes — the daemon or the system extension — manage these settings and then have clients use an IPC mechanism to request changes. The managing process can then authenticate those requests as it sees fit.

If you use XPC as your IPC mechanism you can authenticate either the user (using Authorization Services, as shown by EvenBetterAuthorizationSample) or the client process (see here) or both.

Share and Enjoy

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

Sharing settings between processes and users
 
 
Q