Sub topic 2
What the Mac App Store review and sandbox give you
This chapter assumes you know the Finder, the Applications folder and System Settings, and that you can tell an app from a .dmg or .pkg file. The command-line parts are optional.
Two layers of protection
Apps from the Mac App Store pass through two safeguards that web downloads do not get by default: human and automated review, and the app sandbox. The review checks the app before you see it. The sandbox limits what the app can do after you install it.
What review checks
Apple reviews each app and each update before it is published. Review looks at several things:
- The app does what its description says.
- The app follows Apple's rules on privacy, payments and content.
- The app is free of known malware.
- The developer has an Apple Developer account tied to an identity.
Review lowers risk, but it is not a guarantee. Some bad apps get through, and Apple can remove them afterward. Review does not make an app good, fairly priced or well made.
What the sandbox restricts
Every Mac App Store app must run in the app sandbox. The sandbox is a macOS security feature that confines an app to its own container and to the resources it has declared it needs. These resources are called entitlements.
A sandboxed app cannot freely do the following:
- Read or write files outside its own container, unless you pick them in an open or save dialog.
- Use the camera, microphone, location or contacts without a permission prompt.
- Make network connections, unless it declares that entitlement.
- Change other apps or system files.
This limits the damage if an app has a bug or turns out to be malicious. It cannot read your whole home folder just because it wants to.
Checking a sandboxed app yourself
You can list the entitlements of an installed app in Terminal. Replace Example with the app's name.
codesign -d --entitlements - /Applications/Example.appLook for the key com.apple.security.app-sandbox. If its value is true, the app is sandboxed. Other keys, such as com.apple.security.network.client, show which extra abilities it asked for.
What you do not get
- Not every useful app is on the Mac App Store, because the sandbox rules rule out some tools, such as system utilities.
- Apps outside the store are not necessarily unsafe. They rely on code signing, notarization and Gatekeeper instead, which later chapters cover.
- Sandboxing does not stop an app from misusing the permissions you grant it. Review those permissions, as a later chapter explains.
Exercise
A Mac App Store app asks to open a file. Why can it open only the file you choose in the dialog, and not your whole Documents folder?
Show answer
The app runs in the sandbox, which confines it to its own container. Files you pick in an open or save dialog are the exception, because macOS grants access to those specific files. Access to other folders needs an entitlement or a permission you grant.