Documentation
¶
Overview ¶
Package tcc identifies macOS TCC (Transparency, Consent, and Control) protected locations so filesystem walks can skip them and avoid triggering system permission prompts on a user's machine.
Two independent skip classes, each with its own toggle and its own default, because the prompt/coverage trade-off differs between them:
- Protected directories (~/Documents, ~/Library, …), gated by Enabled. Skipped by default — nothing developers care about lives there.
- Network volumes (non-local mounts, which is how macOS classifies OrbStack/Docker/Colima container mounts), gated by SkipNetworkVolumes. Walked by default — that walk is the only thing that inventories packages inside dev containers.
ForRun resolves both toggles and builds the one Skipper the scan uses.
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 or false to apply the default (skip TCC-protected dirs), true to include them in the scan.
Default behavior is to skip — both community (`scan`) and enterprise (`send-telemetry`) runs avoid TCC-protected paths so the agent never triggers permission prompts. Customers who have granted the agent access (via a PPPC profile pushed by their MDM, or by manually approving "Full Disk Access" in System Settings) flip the bool to `true` to opt those paths back into the scan. See docs/macos-tcc-permissions.md for the configuration recipe.
func SkipNetworkVolumes ¶ added in v1.17.0
SkipNetworkVolumes reports whether the network-volume skip class should be active for this run. The override is the resolved tri-state cfg/config value: nil or true to apply the default (walk them), false to skip them.
The polarity is the mirror image of Enabled, deliberately. Container runtimes expose their filesystems over virtiofs and friends, which macOS classifies as Network Volumes, so the first walk into an OrbStack / Docker / Colima mount fires a kTCCServiceSystemPolicyNetworkVolumes prompt. Skipping by default would suppress the prompt but also drop the package inventory inside dev containers — supply-chain surface nothing else covers — so the default keeps the coverage and admins who can't pre-approve the prompt via PPPC opt out per fleet with include_network_volumes: false. See docs/macos-tcc-permissions.md.
Types ¶
type Skipper ¶
type Skipper struct {
// contains filtered or unexported fields
}
Skipper matches TCC-protected locations. Build one per scan via ForRun (or New for the protected-dirs class alone); share across detectors. Hits are tracked so callers can prove from logs which protected paths were actually encountered during the walks.
func ForRun ¶ added in v1.17.0
ForRun builds the Skipper for one scan from both tri-state toggles. It returns nil when neither class is active — every Skipper method is nil-safe, so callers hand the result straight to detectors without branching.
Enumerating the mount table is a metadata read, not a volume access, so it never fires the prompt it exists to avoid.
func New ¶
New builds a Skipper for the protected-directories class alone, 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. Network-volume mounts are not included — see NetworkVolumes.
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) NetworkVolumes ¶ added in v1.17.0
NetworkVolumes returns the network-volume mount points the Skipper would skip, sorted lexicographically. Empty on the default path (network volumes are walked) and on non-darwin builds. Useful for surfacing in logs which mounts a fleet's include_network_volumes: false actually cost it in coverage.
func (*Skipper) ShouldSkip ¶
ShouldSkip reports whether path is a TCC-protected directory — or a skipped network-volume mount point — whose walk should be short-circuited. When path equals walkRoot the result is always false: passing --search-dirs ~/Documents (or --search-dirs ~/OrbStack) is an explicit opt-in, and the walk root must be entered for anything to happen. That opt-in holds for the whole walk, not just the root itself: if walkRoot is inside a skipped volume, descendants of it are not re-skipped as the walk descends into them.
Callers must consult this BEFORE reading the directory: it is the mountpoint's ReadDir, not the parent's listing of it, that fires the network-volume prompt.
Safe to call on a nil receiver (returns false), which is what callers pass when --include-tcc-protected is set and no volume class is skipped.
func (*Skipper) WithinProtected ¶ added in v1.14.0
WithinProtected reports whether path is a TCC-protected directory OR lies beneath one (e.g. ~/Documents/my-project). It differs from ShouldSkip, which matches only the protected directory itself as a walk descends into it and so relies on the walk passing through the protected parent. Callers that resolve a deep path directly — and would otherwise stat inside the protected tree, firing the very prompt we avoid — must use this BEFORE any filesystem access. Safe on a nil receiver (returns false), matching the --include-tcc-protected opt-in. Records a hit against the matched protected root so LogHits surfaces the skip. Also matches paths under a skipped network-volume mount, for the same reason: resolving into one is what triggers the prompt.