Sandboxed Mac Apps Can Record Screen Any Time Without You Knowing (bleepingcomputer.com)
Catalin Cimpanu, writing for BleepingComputer: Malicious app developers can secretly abuse a macOS API function to take screenshots of the user's screen and then use OCR (Optical Character Recognition) to programmatically read the text found in the image. The function is CGWindowListCreateImage, often utilized by Mac apps that take screenshots or live stream a user's desktop. According to Fastlane Tools founder Felix Krause, any Mac app, sandboxed or not, can access this function and secretly take screenshots of the user's screen. Krause argues that miscreants can abuse this privacy loophole and utilize CGWindowListCreateImage to take screenshots of the screen without the user's permission.
Should only be able to screenshot windows that are owned by the running process, not the entire display screen without being granted a specific permission to access whole display.
...Does the sandbox promise to change this?...
Yes. A sandbox is a sandbox. You play inside your sandbox and are unable to affect or access things outside your sandbox that you should not access. It seems that, at some point, Apple forgot to restrict access to this API for sandboxed apps.
Yes, the entire point of a sandbox is it can't get data from other apps.
Or at least without specific warnings that it's doing something outside of just being a self contained app.
I wonder if any other security-conscious OSes have this security-hole? Looks like a pretty easy one to miss.
There is a saying: "You can program Fortran in any language"... and it applies here: "You can X Windows in any OS".