How brandon7cc/mac-wheres-my-bootstrap works
Main Components
• XPC2Proc Host Application – This is the main macOS app. It is where all the modules are integrated and run. Mark this as the container for the other internal components.
• Detection Module – Found under the Detection directory with files like CodeSigning.swift and DetectionEngine.swift. This module is responsible for validating code signing and detecting exploitation attempts.
• Endpoint Security (ES) Module – Under the Endpoint Security directory (ESClient.swift and EventModel.swift), which handles reception and basic parsing of macOS Endpoint Security events such as XPC_CONNECT events.
• SwiftLaunchCtl Module – Contains logic for resolving service names to program paths as well as interfacing with launchd. Files such as LaunchCtl.swift, DomainsAndTargets.swift, and entry.swift exemplify how the app programmatically queries and tests launchd responses.
• UI Module – Found under the UI directory (with files like ContentView.swift, ConnectionsTable.swift, etc.). This provides the front-end for user interaction and displays output, including potential alerts regarding detected exploits.
• Resources & Assets – This includes visual assets (AppIcon, AccentColor) and any other resource files that support the user interface.
• Test Suite – Located in the tests folder. It contains build scripts and C source files for testing XPC connections (e.g., xpc_connection_tester.c).
Relationships and Data Flows
• The UI component interacts with the underlying detection logic. For example, user actions in the UI trigger operations in the Detection module.
• The Detection engine collaborates with the Endpoint Security module to listen for and parse XPC-related events.
• The SwiftLaunchCtl module bridges communication between the application and macOS launchd services. It is used both in the main app and in the tests to resolve and validate service paths dynamically.
• Data flows are often directional: events are received from macOS’s Endpoint Security, then passed to the Detection engine, which in turn may leverage SwiftLaunchCtl to interrogate service details and present results via the UI.
Architectural Patterns & Design Principles
• Modular Organization: The separation of concerns is evident—each folder/module (Detection, Endpoint Security, SwiftLaunchCtl, UI) represents a distinct aspect of the system.
• Integration of System-Level APIs: The project uses macOS system frameworks (for Endpoint Security and launchd) and exemplifies bridging between Swift and lower-level system functionalities (evident via the bridging header).
• Programmatic Resolution and Testing: Through the SwiftLaunchCtl module, the project demonstrates dynamic resolution of service targets, reflecting a real-time, exploratory design that interacts with system services.
Content
• Interaction flows:
• The user starts the app (UI) → triggers a detection process.
• Detection module receives event data from Endpoint Security → validates code signing via its internal logic.
• In parallel, SwiftLaunchCtl is called to resolve the program path of the involved XPC service.
• Architectural elements such as the programmatic API interactions detailed in the README, along with any configuration or entitlements indicated by files like XPC2Proc.entitlements and the bridging header.