KeyForge is built from the ground up with a Security-First Architecture designed by software engineers and cybersecurity analysts. Because input automation software interacts directly with the operating system's low-level input queues (user32.SendInput and SetWindowsHookEx), macro utilities historically suffer from severe security and reliability vulnerabilities.
- Threat: Many legacy macro tools use scripting engines,
eval(),exec(),pickle, or embedded shell commands in saved macro files, turning community-shared macros into malware delivery vectors. - Mitigation:
- KeyForge profiles (
.kfmacro.json) are strictly declarative data structures parsed viajson.loadswith custom depth/size limits. - Zero dynamic code evaluation (
eval,exec,pickle,subprocess,os.system) exists anywhere in the runtime or profile loader. - Every action type, key name, mouse button, coordinate, and timing parameter is validated against a strict allowlist schema (
keyforge.security.validator).
- KeyForge profiles (
- Threat: Silent corruption or unauthorized modification of saved macro files causing erratic input behavior.
- Mitigation:
- Saved profiles compute and embed a canonical SHA-256 integrity digest (
integrity_sha256) over the normalized macro payload. - When loading a profile, KeyForge verifies the SHA-256 digest before parsing steps into the engine (with explicit user notification if a file was manually edited outside KeyForge).
- Saved profiles compute and embed a canonical SHA-256 integrity digest (
- Threat:
- Malformed "JSON bomb" files (deeply nested Repeat loops or gigabyte files) crashing the application.
- Zero-delay infinite loops (
0mswait) flooding the WindowsUSER32input queue and locking the user out of their PC. - Stuck modifier keys (
Shift,Ctrl,Alt) or mouse buttons left depressed when a macro is aborted mid-cycle.
- Mitigation:
- File Size & Complexity Caps: Maximum profile file size is capped at
1 MiB; maximum step count (5,000), maximum repeat nesting depth (5), and maximum expanded execution operations per cycle (100,000) are strictly enforced. - OS Input Queue Flood Protection: If a repeating macro loop contains
0mstotal delay across an entire cycle, the execution engine automatically enforces a configurable minimum safety yield (MIN_SAFE_CYCLE_DELAY_MS = 5ms) so the Windows kernel and UI thread remain responsive. - Hardware Panic Kill-Switch: A dedicated low-level hotkey (
F12by default) immediately trips an atomicthreading.Event, waking any active wait timer within<5ms. - Automatic Stuck-Input Sanitizer: The executor tracks every depressed key (
KEY_DOWN) and mouse button (MOUSE_DOWN) in a thread-safe ledger and unconditionally dispatches matchingKEY_UP/MOUSE_UPevents in afinally:block upon completion, stop, panic abort, or exception.
- File Size & Complexity Caps: Maximum profile file size is capped at
- Threat: A macro sends a keystroke that triggers its own Start hotkey or gets re-recorded by the Live Recorder, causing exponential recursion.
- Mitigation:
- Every synthetic Win32
INPUTevent dispatched by KeyForge is stamped with a magic signature indwExtraInfo(0x4B465247/"KFRG"). - Both the Live Recorder and Global Hotkey hooks inspect
dwExtraInfoand ignore synthetic events generated by KeyForge itself.
- Every synthetic Win32
- Threat: Malicious file paths or symlinks overwriting sensitive system files.
- Mitigation:
- Profile paths are canonicalized with
Path.resolve(), verified against null bytes, restricted to.json/.kfmacro.jsonextensions, and written atomically via temporary file swap.
- Profile paths are canonicalized with
- KeyForge collects zero analytics, usage telemetry, advertising SDKs, or third-party tracking.
- KeyForge's Windows Setup Installer (
KeyForge-Setup-Windows-x64.exe/keyforge.installer) installs strictly into per-user AppData (%LOCALAPPDATA%\Programs\KeyForge) without requiring elevated Administrator privileges, preserves all configs and saved macros across upgrades and default uninstalls, and never fetches unverified binaries from third-party mirrors. - To protect against supply-chain tampering, KeyForge's built-in updater (
keyforge.updater):- Contacts only the official GitHub Releases API over HTTPS (
https://api.github.com/repos/efeartn/KeyForge/releases/latest) and rejects insecurehttp://redirects or unsupported schemes. - Verifies the downloaded executable stream using constant-time SHA-256 (
hmac.compare_digest) against the release.sha256.txtdigest before allowing replacement. - Preserves user configuration (
config.json) and active profile backups in the OS-standard user data directory across upgrades, and supports disabling startup update checks via"check_updates_on_startup": falseinconfig.jsonfor fully air-gapped environments.
- Contacts only the official GitHub Releases API over HTTPS (
If you discover a security issue in KeyForge, please open a GitHub Security Advisory on the repository or contact the maintainer directly before public disclosure.