Fix embedded macOS app bundles stealing software title names#46366
Draft
sharon-fdm wants to merge 1 commit into
Draft
Fix embedded macOS app bundles stealing software title names#46366sharon-fdm wants to merge 1 commit into
sharon-fdm wants to merge 1 commit into
Conversation
Embedded app bundles (login helpers, framework helpers, etc.) nested inside another .app's Contents/ directory often share the parent app's bundle_identifier. When these were ingested before the main app, they could claim the software title name (e.g., "AmphetamineLoginHelper" instead of "Amphetamine"). Filter at two layers: - osquery query: WHERE path NOT LIKE '%.app/Contents/%' - Go ingestion: isEmbeddedMacOSAppBundle() check in directIngestSoftware
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46366 +/- ##
=======================================
Coverage 66.89% 66.90%
=======================================
Files 2783 2784 +1
Lines 221736 221794 +58
Branches 11356 11356
=======================================
+ Hits 148335 148391 +56
+ Misses 60000 59997 -3
- Partials 13401 13406 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #44199
Summary
.app'sContents/directory (e.g.,Amphetamine.app/Contents/Library/LoginItems/AmphetamineLoginHelper.app) and often share the parent app'sbundle_identifierHow it was reproduced
Reproduced locally on a MacBook running Fleet's orbit agent. No VPP or test instance needed.
Step 1 -- osquery proof of duplicate bundle IDs on this machine:
This showed 68 embedded app bundles on this Mac, including real instances of the bug pattern:
com.anthropic.claudefordesktop.helpershared byClaude Helper.appandClaude Helper (Plugin).app(both insideContents/Frameworks/)com.microsoft.VSCode.helpershared byCode Helper.app,Code Helper (GPU).app,Code Helper (Plugin).appContents/Library/LoginItems/andContents/Library/LaunchAgents/Step 2 -- logic reproduction: A standalone Go script simulating Fleet's
bestTitleNameslogic confirmed:longestCommonPrefixpicks the correct namebundle_identifierand reuses it -- the name is never correctedStep 3 -- SQL filter verification:
Changes
Two-layer filter:
osquery query (
softwareMacOSinqueries.go): AddedWHERE path NOT LIKE '%.app/Contents/%'to theFROM appsquery, preventing embedded bundles from being collected at the sourceGo ingestion (
directIngestSoftwareinqueries.go): AddedisEmbeddedMacOSAppBundle()check that skips any macOS app whoseinstalled_pathcontains.app/Contents/. This is defense-in-depth in case data arrives from other pathsTest plan
TestIsEmbeddedMacOSAppBundle-- unit test covering main apps, login helpers, framework helpers, launch agents, system apps, user library apps, empty pathsTestDirectIngestSoftware/embedded_macOS_app_bundles_are_filtered_out-- integration test simulating the exact Amphetamine scenario (main app + login helper with same bundle ID; only main app should be ingested)TestShouldRemoveSoftwareandTestDirectIngestSoftwaresubtests still passgo vetandgo buildclean