How hotcakex/harden-windows-security works
Project type and purpose
• This is a single Git repository hosting two related Windows desktop applications:
• “Harden System Security” – a WPF/UWP‐style .NET 9 app that applies OS hardening and displays compliance.
• “AppControl Manager” – another .NET WPF/UWP app for creating and deploying Windows Application Control (WDAC) policies.
• Both are full-stack desktop applications using MVVM, with rich UI, business logic modules, native/interop components, background services, and external integration (Intune via Microsoft Graph).
File structure analysis
• Top-level:
• AppControl Manager/
• Harden System Security/
• Intune Files/ (JSON policies)
• .github/workflows (CI/CD, package scans, store builds)
• Cargo projects under eXclude (Rust utilities)
• Each app directory follows the pattern:
• App.xaml, manifest, .csproj – entry points, packaging.
• Pages, ViewModels – MVVM layers.
• CppInterop – native COM EXEs for privileged OS operations.
• RustInterop – FFI libraries (policy serializers, validators).
• IntelGathering, Main, XMLOps, SiPolicy, Signing, SimulationMethods, Others – core business logic modules.
• Background services: QuantumRelayHSS, DISMService (exposed via named pipes or COM) for running privileged tasks.
• Resources (XML/JSON policy templates), Assets (images, audio).
README insights
• The README describes two main products, their use cases (personal/enterprise hardening and App Control policy management), and how they leverage only built-in Windows APIs (no third-party).
• Mentions Intune integration via Graph API, deep OS interactions (Group Policy, BitLocker, Event Logs, MDE logs), and defense-in-depth.
Main components
a. Presentation layer (UI):
– Two WPF/UWP apps (“Harden” & “AppControl Manager”)
b. Business logic modules:
– Policy creation & editing (XMLOps, SiPolicy, Signing)
– System intelligence gathering (IntelGathering, SimulationMethods)
– Hardening operations (Main, Helpers, Protection categories)
c. Interop/native layer:
– CppInterop/ComManager.exe – privileged COM server for BitLocker, Firewall, DISM, Group Policy
– DISMService.exe – C#/.NET service for provisioned feature management
– RustInterop – FFI library for policy serialization, cryptographic tasks
– QuantumRelayHSS – named-pipe based relay between UI and high-privilege service
d. Data/config layer:
– Local file storage: policy XML/JSON files, logs, resources
– Local OS stores: Registry, Event Logs, Certificates store
e. External services:
– Microsoft Graph API (Intune)
– Microsoft Store (app installs, updates)
Relationships and interactions
• UI → ViewModels → Business Logic → Interop/Services → OS Subsystems
• Business Logic modules call into:
• ComManager (via COM interfaces) for BitLocker, firewall, virtualization
• DISMService for feature provisioning
• QuantumRelayHSS for kernel-mode policy enforcement tasks
• RustInterop functions for XML ↔ CIP policy transformations and signing
• Business Logic also reads/writes local policy template files and system logs.
• External: policy JSON files under Intune Files are pushed via Graph API from the app.
Architectural patterns & design principles
• MVVM separates UI (Views/CustomUIElements) from state & commands (ViewModels) and core logic.
• Layered architecture: Presentation → Application Services → Platform/Interop → OS.
• IPC patterns: COM for synchronous privileged operations, named pipes for asynchronous tasks.
• Extensibility: JSON/XML templates for policy definitions, plugin-like modules for different hardening categories.
Relevant technologies/frameworks
• .NET 9, WPF/UWP (XAML), C#
• MVVM (ViewModels, RelayCommand)
• COM interop (C++/Win32) via ComManager.exe
• .NET background services (DISMService)
• Rust + FFI (RustInterop crates)
• Named pipes (QuantumRelayHSS)
• Microsoft Graph SDK/REST for Intune integration
• AppX/MSIX packaging (Package.appxmanifest)
• CI/CD: GitHub Actions for build, scan, package, attestation