tcc

package
v1.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Enabled(override *bool) bool

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

func New(home string) *Skipper

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

func (s *Skipper) Candidates() []string

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

func (s *Skipper) Hits() map[string]int

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

func (s *Skipper) LogHits(emit func(format string, args ...any))

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

func (s *Skipper) ShouldSkip(path, walkRoot string) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL