Repository navigation
FnKeyboard v1.1.0 — Security Hardening
This release significantly hardens FnKeyboard's security posture — from memory safety in low-level system APIs to build-time integrity checks and runtime protections against event flooding.
What's New
Runtime Security
- Memory-safe event tap lifecycle — replaced raw
Unmanaged<Self>pointer with a weak-referenceTapContextwrapper, eliminating dangling-pointer dereferences if the monitor is deallocated while the CGEvent tap callback is in-flight - Thread-safe monitoring flag —
isMonitoringis now protected byNSLockfor safe access across the main thread and the CGEvent tap callback - CGEvent memory leak fix — switched from
passRetainedtopassUnretainedfor event return values (listenOnly taps ignore the return, so retaining leaked every keyboard event flowing through the system) - Reduced event surface — removed
flagsChangedfrom the event mask; onlykeyDownandkeyUpare intercepted
Rate Limiting & Debouncing
- Per-key rate limiting in
KeySimulator— enforces a 150ms minimum interval between simulated presses, preventing event flooding from rapid automated clicks - UI tap debouncing in
FunctionKeyView— 200ms cooldown as a second layer of defense - Input validation —
KeySimulatornow validates key IDs (1–12) before processing @MainActorannotation onKeySimulatorto guarantee thread-safe access to mutable state
Build & Signing
- Hardened Runtime with zero entitlement exceptions — protects against
DYLD_INSERT_LIBRARIESinjection, unsigned executable memory, and debugger attachment - Code signing integrated into build.sh with support for
CODESIGN_IDENTITY(distribution) and ad-hoc fallback (development) - SHA-256 integrity verification of generate_icon.swift against the committed version before execution (supply-chain protection)
--timestampon distribution signatures for notarization support
Other Improvements
- Added
NSAccessibilityUsageDescriptionto Info.plist for a clear permission prompt - Added comprehensive Security section to README documenting permissions, privilege model, and runtime protections
- Added installation guide with download and build-from-source paths
- Dual-architecture release builds (arm64 + x86_64 DMGs) via
.build.sh --release
Download
| File | Architecture |
|---|---|
FnKeyboard-macos-arm64.dmg |
Apple Silicon (M1/M2/M3/M4) |
FnKeyboard-macos-x86_64.dmg |
Intel |
Upgrading
Drop-in replacement — just replace the app in Applications. Make sure to remove and add permissions in Accesibility and Input Monitoring. Run xattr -cr /path/to/FnKeyboard.app to bypass Gatekeeper due to a lack of a developer certificate at the time of building.