App Management permission
Issue #47: pre-approving AAP’s TCC App Management permission via a
com.apple.TCC.configuration-profile-policyprofile.
Why this is needed
Section titled “Why this is needed”macOS requires a TCC permission called App Management
(SystemPolicyAppBundles) for any process that wants to modify an
installed .app bundle in /Applications. It exists from macOS 13
(Ventura), so it applies to every macOS App Auto-Patch supports (14 and
later). Installomator’s whole job is to
replace .app bundles in /Applications, so without this permission
patching either silently no-ops on a label or interactively prompts
the user to grant access on first use.
On consumer Macs, the OS prompt is acceptable. On managed Macs the standard practice is to pre-approve the permission via a TCC configuration profile so end-users never see the prompt and admins don’t have to coordinate with help-desk to re-approve after every OS upgrade.
Which process needs the approval
Section titled “Which process needs the approval”This is the part that has historically confused admins (it confused
Dan when he assembled the first attempt for issue #47): the GUI
app — xyz.techitout.appAutoPatch — never modifies installed app
bundles. The actual .app replacement happens inside
Installomator.sh, which is launched as a child process of the root
helper LaunchDaemon (bundle ID xyz.techitout.appAutoPatch.roothelper,
launchd label xyz.techitout.appAutoPatch.roothelper, binary embedded
at Contents/MacOS/AppAutoPatchRootHelper inside the AAP .app bundle).
A TCC profile that only targets the GUI app’s bundle identifier won’t do anything useful — the GUI never asks for App Management because it never modifies installed apps. The grant has to be against the helper. That’s why a manually-assembled profile of the GUI’s identifier alone “appears correct” but “doesn’t show as enabled” in System Settings → Privacy & Security → App Management — the OS quietly drops the rule because the identified subject never requests the right.
Sample profile
Section titled “Sample profile”A ready-to-sign example is at
Profile Manifests/com.apple.TCC.configuration-profile-policy-AppAutoPatch.example.mobileconfig.
It contains two TCC SystemPolicyAppBundles entries, one for the GUI
and one for the helper (used for the actual app-bundle replacement
during patching), plus a SystemPolicyAllFiles (Full Disk Access)
entry for the GUI, which reads the Do Not Disturb database for Focus
deferrals. Login Items & Extensions approval comes from a separate
profile, com.apple.servicemanagement-AppAutoPatch.example.mobileconfig.
Sign with productsign / your MDM’s own signing flow before
deployment. Sample plist looks like:
<key>Services</key><dict> <key>SystemPolicyAppBundles</key> <array> <!-- 1. GUI app --> <dict> <key>Allowed</key> <true/> <key>Identifier</key> <string>xyz.techitout.appAutoPatch</string> <key>IdentifierType</key> <string>bundleID</string> <key>CodeRequirement</key> <string>identifier "xyz.techitout.appAutoPatch" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and (certificate leaf[subject.OU] = "6GBSVT64FS" or certificate leaf[subject.OU] = "VRP7YQ5V7J")</string> </dict> <!-- 2. Root helper --> <dict> <key>Allowed</key> <true/> <key>Identifier</key> <string>xyz.techitout.appAutoPatch.roothelper</string> <key>IdentifierType</key> <string>bundleID</string> <key>CodeRequirement</key> <string>identifier "xyz.techitout.appAutoPatch.roothelper" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and (certificate leaf[subject.OU] = "6GBSVT64FS" or certificate leaf[subject.OU] = "VRP7YQ5V7J")</string> </dict> </array></dict>The
subject.OUvalue has to be the Team ID that signed the installed app. Every requirement in the sample accepts both 6GBSVT64FS (builds up to 134) and VRP7YQ5V7J (from build 135). See Which Team ID below before deploying the profile.
Verifying
Section titled “Verifying”After deploying the profile, on a target Mac:
sudo log show --predicate 'subsystem == "com.apple.TCC"' --info --last 5m | grep -i "appauto\|appautopatch"You should see lines like granted permission kTCCServiceSystemPolicyAppBundles
for both bundle identifiers. The tccutil reset path for that service
is also useful when reproducing pre-approval issues:
sudo tccutil reset SystemPolicyAppBundles xyz.techitout.appAutoPatch.roothelperSystem Settings → Privacy & Security → App Management will list the helper as Managed by your organization once the profile is installed and the rule has matched.
Checking the rules for both teams
Section titled “Checking the rules for both teams”Before your Macs update to build 135, check on a test Mac that the
installed profiles accept both signing teams (see Which Team ID
below). system_profiler lists every installed profile’s privacy
rules and doesn’t need sudo. For a quick look, this prints the team
part of each App Auto-Patch rule; every line should name VRP7YQ5V7J:
system_profiler SPConfigurationProfileDataType | grep -F 'CodeRequirement = "identifier \"xyz.techitout.appAutoPatch' | grep -o 'subject.OU] = \\"[A-Z0-9]*\\".*' | sort | uniq -cFor a full check, paste this into Terminal. It prints one line per rule, with the profile it came from:
app="/Applications/App Auto-Patch.app"printf 'Installed: %s (%s), team %s\n\n' "$(defaults read "$app/Contents/Info" CFBundleShortVersionString 2>/dev/null)" "$(defaults read "$app/Contents/Info" CFBundleVersion 2>/dev/null)" "$(codesign -dv "$app" 2>&1 | sed -n 's/^TeamIdentifier=//p')"system_profiler SPConfigurationProfileDataType 2>/dev/null | awk ' /^ [^ ].*:$/ { profile = $0; sub(/^ +/, "", profile); sub(/:$/, "", profile) } /^ [A-Za-z]+ = +\($/ { service = $1 } /^ +\{$/ { req = "-" } /^ +CodeRequirement = / { req = $0; sub(/^ +CodeRequirement = "/, "", req); sub(/";$/, "", req); gsub(/\\"/, "\"", req) } /^ +Identifier = "xyz\.techitout\.appAutoPatch/ { id = $3; gsub(/[";]/, "", id); print service "\t" id "\t" req "\t" profile; n++ } END { if (!n) print "NONE" }' | while IFS=$'\t' read -r service id req profile; do if [ "$service" = "NONE" ]; then echo "No App Auto-Patch privacy rules in the installed profiles."; continue; fi case "$id" in *.roothelper) bin="$app/Contents/MacOS/AppAutoPatchRootHelper" ;; *) bin="$app" ;; esac notes="" case "$req" in *VRP7YQ5V7J*) ;; *) notes="$notes << no VRP7YQ5V7J: lost on build 135" ;; esac case "$req" in *" or "*) case "$req" in *"(certificate leaf[subject.OU]"*) ;; *) notes="$notes << team check not in parentheses" ;; esac ;; esac if [ -e "$bin" ] && ! codesign -v -R="$req" "$bin" 2>/dev/null; then notes="$notes << does not match the installed copy"; fi if [ -z "$notes" ]; then result=OK; else result=FIX; fi printf '%-4s %-23s %-38s %s%s\n' "$result" "$service" "$id" "$profile" "$notes"doneWith the example profile on a Mac that runs build 134:
Installed: 4.0.0 (134), team 6GBSVT64FS
OK SystemPolicyAllFiles xyz.techitout.appAutoPatch App Auto-Patch — Privacy PreferencesOK SystemPolicyAppBundles xyz.techitout.appAutoPatch App Auto-Patch — Privacy PreferencesOK SystemPolicyAppBundles xyz.techitout.appAutoPatch.roothelper App Auto-Patch — Privacy PreferencesA profile with other rules for AAP, such as Apple events to
swiftDialog, adds a line for each. The rule that App Management
depends on is SystemPolicyAppBundles for
xyz.techitout.appAutoPatch.roothelper. A FIX line names what to
change:
- no VRP7YQ5V7J — the rule names only the old team, so the Mac loses that grant once it updates to build 135. Add the team as shown in Which Team ID.
- team check not in parentheses — without them,
A and B or Creads as(A and B) or C, so the rule accepts any app from the second team. Put the twosubject.OUchecks in parentheses, as in the example profile. - does not match the installed copy — the requirement doesn’t accept the build installed now, so that grant isn’t in effect.
A FIX line under a different profile name usually means an older
profile for the same app is still installed. Remove it from scope so
only the two-team profile is left. Run the check again after the Mac
updates to build 135: an OK line then shows that the rule accepts
the VRP7YQ5V7J build.
Which Team ID
Section titled “Which Team ID”Privacy and Service Management profiles match the app’s signing
certificate. certificate leaf[subject.OU] and a Service Management
TeamIdentifier rule must equal TeamIdentifier from the copy that
is actually installed.
App Auto-Patch is moving to a new signing team. Builds up to 4.0.0
(134) are signed by 6GBSVT64FS, and builds from 4.0.0 (135) by
VRP7YQ5V7J:
| Team ID | Certificate | Signs |
|---|---|---|
6GBSVT64FS |
Developer ID Application: Robert Schroeder | 4.0.0 up to build 134 |
VRP7YQ5V7J |
Developer ID Application: App Auto-Patch LLC | 4.0.0 from build 135 |
Deploy a profile that accepts both teams before your Macs update to
build 135. A Mac keeps the old build’s grants only while the old
build is installed: once build 135 is installed, a requirement that
names only 6GBSVT64FS no longer matches, so the root helper loses
App Management (patching prompts or fails) and the app loses Full Disk
Access. The example profile already accepts both. Keep both until
every Mac runs build 135 or later; after that, 6GBSVT64FS can be
removed from each or.
Confirm on a Mac that has the build you are deploying:
codesign -dv --verbose=2 "/Applications/App Auto-Patch.app" 2>&1 | grep TeamIdentifierA profile whose requirements name only 6GBSVT64FS does not grant
Full Disk Access or App Management to a build whose
TeamIdentifier is VRP7YQ5V7J. macOS ignores the rule. Do Not
Disturb detection then fails closed: the GUI log says the assertions
database could not be opened, and focus deferrals do not run (#94).
A profile of your own, for example one made with PPPC Utility, names
one team in each requirement: add
or certificate leaf[subject.OU] = "VRP7YQ5V7J" to each one, in
parentheses with the existing team as in the sample above. A Service
Management profile with a TeamIdentifier rule needs a second rule for
VRP7YQ5V7J; the sample uses Label rules, which don’t name a team.
A build you sign yourself needs your own team ID instead.
Full Disk Access is the SystemPolicyAllFiles service on the GUI
bundle xyz.techitout.appAutoPatch. The example profile includes it.
The root helper does not read the Do Not Disturb database.
Designated requirement strings
Section titled “Designated requirement strings”If you need to (re)derive the strings for a fork, run on a built copy of AAP:
codesign -dr - "/Applications/App Auto-Patch.app"codesign -dr - "/Applications/App Auto-Patch.app/Contents/MacOS/AppAutoPatchRootHelper"Each prints a designated => … line; that’s the value to paste into
the profile’s CodeRequirement field.
Related
Section titled “Related”Profile Manifests/MDM-ServiceManagement.md—com.apple.servicemanagementpayload that pre-approves the helper LaunchDaemon’s Login Items & Extensions registration. Different permission, but the two profiles are usually deployed together.Profile Manifests/MDM-Notifications.md— pre-approves user notifications for AAP.Profile Manifests/MDM-LaunchAgent.md— keeps the GUI running silently in the user’s session.
