MacOS – How does macOS process protection work – Cliff Notes style

macossandboxSecurity

Looking at Apple dev forums and not having programmed in C since college, I'm a bit out of my depth trying to understand the fundamentals of the components of MacOS' protection model employed over the past few OS releases and how it affects security on the whole.

I am not sure where Sandboxes came to be in order to protect us from our selves with programs that did naughty things, but I would so appreciate a better understanding of how it works and what happens when said naughtiness occurs.

I'm guessing the Errors and Faults in Console are related to access and protection issues based on their context and the fact I do run some softs that are not giving the Apple seal of Kwality at software install. I more than likely have processes banging into things or processes failing to access resources. Console I see just streams of Errors and Faults – around 100 per minute on average and they would appear to be rights issues of some sort. The one error I see constantly on of my macs more than any other (usually) is from WindowServer such as:

_CGXWindowIsOrderedIn: Operation on a window 0xa4 requiring rights <private> by caller <private>

0xa4 appears to be any 2 digit hex number, presumably the address of a window, perhaps? (Then gain, it seems like 16^2 windows is not a lot, so maybe this is a very incorrect interpretation.)

In any case, in the interests of cleaning house and possibly identifying apps or libraries that are problematic rather than try to get help with each and every little thing that may or may not be important, maybe a quick summary of how things are supposed to work and maybe even a link to a good overview for a sysadmin-type who might want to make his machine not run like a piece of crap.

Any concisely put wisdom will be gloriously welcomed.

Best Answer

Apple's Documentation Archive

See Apple's App Sandbox Design Guide for both an overview and in-depth discussion of how sandboxing works on their platforms.

You secure your app against attack from malware by following the practices recommended in Secure Coding Guide. But despite your best efforts to build an invulnerable barrier—by avoiding buffer overflows and other memory corruptions, preventing exposure of user data, and eliminating other vulnerabilities—your app can be exploited by malicious code. An attacker needs only to find a single hole in your defenses, or in any of the frameworks and libraries that you link against, to gain control of your app’s interactions with the system.

App Sandbox is designed to confront this scenario head on by letting you describe your app’s intended interactions with the system. The system then grants your app only the access your app needs to get its job done. If malicious code gains control of a properly sandboxed app, it is left with access to only the files and resources in the app’s sandbox.

While the document is marked as not being updated, it remains the best introduction to sandboxing on Apple's platforms.