Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macOS Entitlements audio-input vs. microphone

For the macOS sandbox there are two entitlement keys:

com.apple.security.device.audio-input
com.apple.security.device.microphone

I tested both and both allow microphone input.

What is the difference between them?

like image 453
Hyndrix Avatar asked Apr 01 '18 07:04

Hyndrix


1 Answers

com.apple.security.device.microphone is a sandbox entitlement. If you want to use the microphone in a sandboxed app, you will need to enable it,

com.apple.security.device.audio-input is a hardened runtime entitlement. If you want to use the microphone in an app built with the hardened runtime, you will need to enable it.

If your app is both sandboxed and hardened, you will want to enable both.

Sandboxing and hardening provide overlapping protections in this case.

In a sandboxed app, if you don't have the com.apple.security.device.microphone entitlement, your app will not be able to access the microphone.

In a hardened app, if you don't have the com.apple.security.device.audio-input entitlement, your app will not be able to access the microphone or any audio input using Core Audio,

This provides a good explanation of the relationship between sandboxing and hardening.

We can see in Xcode 10 that the Resource Access section of the Hardened Runtime shows a great deal of overlap with the App Sandbox, while the Runtime Exceptions section has functionality unique to the hardened runtime. What's the reason for the overlap? The sandbox was designed mainly for the App Store, while the hardened runtime was designed mainly for Developer ID. I've just explained in detail how the two technologies can apply to the same app and don't depend on the distribution method, but in the near future the majority of apps will probably use at most one of the two: sandboxing for Mac App Store apps and hardening for notarized Developer ID apps. This is why duplicate entitlements exist.

like image 158
TheNextman Avatar answered Sep 22 '22 10:09

TheNextman