Documentation
¶
Overview ¶
Package tcc identifies macOS TCC (Transparency, Consent, and Control) protected directories so filesystem walks can skip them and avoid triggering system permission prompts on a user's machine.
On non-darwin builds the Skipper is a no-op: ShouldSkip always returns false and Candidates returns nil, so callers can wire it unconditionally.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
Enabled reports whether the TCC skipper should be active for this run. The override is the resolved tri-state cfg/config value: nil to defer to the runtime default, true to explicitly include TCC paths (don't skip), false to explicitly exclude (always skip).
The default (nil override) only skips when the process is running under macOS launchd: that's the context in which TCC permission prompts actually fire and there's nobody at a keyboard to dismiss them. Direct CLI invocations typically inherit Terminal.app's TCC grants and don't see prompts, so they default to full scan coverage.
func IsRunningUnderLaunchd ¶
func IsRunningUnderLaunchd() bool
IsRunningUnderLaunchd reports whether the process appears to be running as a macOS launchd-managed daemon or agent. Detection signals (in order): an explicit STEPSEC_VIA_LAUNCHD=1 env var (escape hatch for tests and forward-compat plist changes), then PPID==1 on darwin (launchd is PID 1 and reparents its jobs). Returns false off darwin.
Types ¶
type Skipper ¶
type Skipper struct {
// contains filtered or unexported fields
}
Skipper matches TCC-protected directories. Build one per scan via New; share across detectors. Hits are tracked so callers can prove from logs which protected paths were actually encountered during the walks.
func New ¶
New builds a Skipper anchored at home. home == "" produces a degraded Skipper that only matches absolute-prefix entries (e.g. Time Machine snapshot mounts) — useful when the agent runs without a console user.
func (*Skipper) Candidates ¶
Candidates returns the exact-match protected paths the Skipper would skip, sorted lexicographically. Useful for surfacing in logs. Returns nil on a nil receiver or on non-darwin builds.
func (*Skipper) Hits ¶
Hits returns the set of TCC-protected paths that were encountered during walks, with the count of times each was matched. Returns nil if nothing was skipped (or on a nil receiver). Safe to call concurrently with ShouldSkip, though callers typically only read after walks complete.
func (*Skipper) LogHits ¶
LogHits emits a single summary line listing the protected paths that were actually encountered during walks. Quiet when nothing was matched (or on a nil receiver). The emit callback decouples this from any specific logger — pass log.Warn (interactive) or log.Debug (daemon) to pick the level. Single source of truth for both community scan and enterprise telemetry.
func (*Skipper) ShouldSkip ¶
ShouldSkip reports whether path is a TCC-protected directory whose walk should be short-circuited. When path equals walkRoot the result is always false: passing --search-dirs ~/Documents is an explicit opt-in, and the walk root must be entered for anything to happen.
Safe to call on a nil receiver (returns false), which is what callers pass when --include-tcc-protected is set.