Documentation
¶
Overview ¶
Package execguard decides whether a detector may safely launch a third-party binary on this machine.
On macOS, executing a quarantined binary (com.apple.quarantine xattr, set by browser downloads and Homebrew cask installs) makes Gatekeeper assess it; when the binary or a native library it loads is not notarized, the OS shows a "could not verify … free of malware / Move to Bin" dialog in the logged-in user's session — a scary popup for something the user never ran themselves. SafeToExec answers, without any UI side effects, whether that would happen, so version probes can skip the exec (reporting "unknown") instead of triggering it. This generalizes the existing IsAppleCLTStub guard (which prevents the analogous Command Line Tools install prompt).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafeToExec ¶
SafeToExec reports whether launching binaryPath is safe from a GUI-popup perspective. Non-macOS platforms always return true.
On macOS it resolves symlinks, then checks the binary and its containing directory for the com.apple.quarantine attribute (cask installs quarantine the whole install tree, so the parent dir catches partially-cleared installs). Unquarantined binaries are safe: Gatekeeper only assesses quarantined files. For quarantined ones, `spctl --assess --type execute` gives Gatekeeper's verdict silently — accepted means executing shows no popup; rejected (or any spctl failure, conservatively) means skip.
Both probes execute only Apple-provided utilities (/usr/bin/xattr, /usr/sbin/spctl), which carry none of the third-party-binary risk this package exists to avoid.
Types ¶
This section is empty.