macOS Entitlements audio-input vs. microphone
Asked Answered
P

1

6

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?

Pignus answered 1/4, 2018 at 7:28 Comment(0)
M
11

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.

Mordvin answered 16/7, 2019 at 15:28 Comment(2)
The obvious question: why do they have two different names for the same thing?Womanhood
Couldn't find a duplicate name for the camera. And I checked in build settings -> Enable App Sandbox is false and hardened runtime true. I guess this is not the problem hereAssagai

© 2022 - 2024 — McMap. All rights reserved.