Documentation
¶
Overview ¶
Package tcc keeps an isolated Caprock daemon out of the folders macOS guards with a privacy prompt (ADR-040).
macOS asks before a process reads the account's Desktop, Documents or Downloads, and remembers the answer per program — for a command-line binary, per path and code signature. A daemon a test, a benchmark or a preview starts runs from a build of its own, so every one that reaches into those folders is another "caprock" in System Settings → Privacy & Security → Files and Folders, and a prompt on the owner's screen. A preview that copies the real database knows the real projects, some of which live there.
An isolated daemon is one whose HOME is not the account's home: every test and stand sets a temporary HOME. Such a daemon refuses those folders of the real account, whatever its database says. The daemon the user runs has its real HOME and is never limited.
Index ¶
- Variables
- func BundleOf(program string) string
- func Check(path string) error
- func Guarded(p string) bool
- func GuardedBeyondWork(p string) bool
- func Isolated() bool
- func ListedName(program string) string
- func OffLimits(path string) bool
- func Responsible(pid int) (program, name string)
- func Target(p string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
var ErrOffLimits = errors.New("an isolated daemon does not touch the account's Desktop, Documents or Downloads")
ErrOffLimits is returned for a path an isolated daemon does not touch.
var Folders = []string{"Desktop", "Documents", "Downloads"}
Folders are the account folders macOS asks about, relative to its home.
Functions ¶
func BundleOf ¶ added in v0.198.0
BundleOf is the `.app` directory program's executable sits in (`X.app/Contents/MacOS/exe`), or "" when it is not in one.
func Guarded ¶ added in v0.94.1
Guarded reports whether reading at or below p would make macOS ask the user for access — for any process, isolated or not. Background work (the repository a session's folder belongs to, the projects list, the folder picker's hints, the Projects panel's git) skips such a place; a read the user asked for (opening a session, a file, a folder) does not.
The places are the account's Desktop, Documents and Downloads, iCloud Drive and cloud-storage providers, the Music, Movies and Pictures folders (the Apple Music, TV and Photos libraries live there), and every mounted volume under /Volumes (removable and network volumes each have their own prompt). Caprock's binary is ad-hoc signed, so macOS treats each release as a new program and an answer given to the last one does not carry over: a background read there asked again after every upgrade.
Symbolic links are followed without touching what they point at: a link in ~/dev to a network share is guarded, and finding that out reads the links, never the share.
func GuardedBeyondWork ¶ added in v0.94.1
GuardedBeyondWork is Guarded without Desktop, Documents and Downloads, for reads up a session's own folder (finding its repository): people keep their projects in Documents, a session there means the user works there, and one prompt per release for that folder is the honest price of grouping it by repository. Music, Movies, Pictures, iCloud Drive, cloud storage and /Volumes stay untouched even then.
func Isolated ¶
func Isolated() bool
Isolated reports whether this daemon runs isolated on macOS and so keeps out of the account's guarded folders.
func ListedName ¶ added in v0.198.0
ListedName is the name System Settings shows for program: an app bundle's folder name without `.app` when program is the executable inside one (`…/Caprock Terminal.app/Contents/MacOS/caprock-pty-host` is "Caprock Terminal"), the file name otherwise. "" for "".
func Responsible ¶ added in v0.198.0
Responsible is the program macOS holds responsible for pid in its privacy prompts and System Settings, and the name System Settings lists it under. It reads two kernel facts and raises nothing: no prompt, no dialog. Both are empty off macOS, for a pid that is gone, or when this macOS does not have the call.
Types ¶
This section is empty.