Security & Privacy

Gatekeeper

Overview

Gatekeeper is macOS's code signing enforcement mechanism that controls which applications are allowed to execute. It verifies that downloaded applications are signed by an identified developer and (since macOS 10.15) notarized by Apple. The Gatekeeper approval database records every application that has been assessed, providing forensic evidence of application execution and user override decisions.

Forensic Significance

Evidence TypeForensic Value
Approved applicationsEvidence of app execution (user clicked "Open" on blocked app)
Denied applicationsAttempts to run unsigned/untrusted software
Override historyUser deliberately bypassed Gatekeeper warnings
Policy configurationSecurity posture (App Store only, identified developers, or anywhere)
Assessment timestampsWhen apps were first executed

File Locations

FilePathFormat
SystemPolicy database/var/db/SystemPolicySQLite
SystemPolicyConfiguration/var/db/SystemPolicyConfiguration/KextPolicySQLite
Gatekeeper statusspctl --status (command)API output
ExecPolicy database/var/db/SystemPolicyConfiguration/ExecPolicySQLite (macOS 12+)

Database Schema

SystemPolicy — authority table

ColumnTypeDescription
idINTEGERPrimary key
typeINTEGERRule type (1=execute, 2=install, 3=open)
requirementTEXTCode signing requirement expression
allowINTEGER1=allowed, 0=denied
disabledINTEGERWhether rule is disabled
expiresREALExpiration timestamp
labelTEXTHuman-readable label
filter_unsignedTEXTFilter for unsigned code
remarksTEXTAdditional information

ExecPolicy (macOS 12+) — executable_policy table

Tracks all executed binaries and their notarization status.

ColumnTypeDescription
bundle_idTEXTApplication bundle identifier
team_idTEXTDeveloper team identifier
signing_idTEXTCode signing identifier
cdhashTEXTCode directory hash
responsible_pathTEXTPath of the responsible process
is_notarizedINTEGERWhether the app is notarized by Apple

Key Fields for Analysis

List Approved Applications

-- SystemPolicy: User-approved apps
SELECT
    requirement,
    allow,
    label,
    remarks,
    datetime(expires, 'unixepoch') AS expires_date
FROM authority
WHERE type = 1 AND allow = 1
ORDER BY expires DESC;

Notarization Status (macOS 12+)

-- ExecPolicy: Executed binaries
SELECT
    bundle_id,
    team_id,
    signing_id,
    responsible_path,
    is_notarized
FROM executable_policy
ORDER BY bundle_id;

Analysis Notes

  • User overrides: When a user right-clicks and selects "Open" on a Gatekeeper-blocked application, an approval record is created. This is direct evidence that the user deliberately executed untrusted software.
  • Policy status: Run spctl --status to determine Gatekeeper's current enforcement mode. A disabled Gatekeeper (assessments disabled) indicates a significantly weakened security posture.
  • Unsigned code execution: Applications without valid code signatures that were approved indicate either legitimate developer tools or potentially malicious software.
  • Team ID analysis: The team_id field in ExecPolicy can identify the developer. Cross-reference with known malware developer team IDs.
  • SIP protection: The SystemPolicy database is protected by SIP. Modifications on a SIP-enabled system indicate compromise.

Version Differences

macOS VersionChanges
10.7 (Lion)Gatekeeper introduced
10.15 (Catalina)Notarization required for all new software
12 (Monterey)ExecPolicy database added for comprehensive execution tracking
13 (Ventura)Enhanced notarization enforcement

Tool Support

ToolSupport
macforNot yet implemented (planned)
spctl (macOS built-in)Query Gatekeeper status and assessments
sqlite3Manual database inspection
codesign (macOS built-in)Verify code signatures

References

Previous
TCC Database