fix(ui): reconcile modifier state for Firefox resistFingerprinting (#1305)#1344
Draft
adamshiervani wants to merge 2 commits into
Draft
fix(ui): reconcile modifier state for Firefox resistFingerprinting (#1305)#1344adamshiervani wants to merge 2 commits into
adamshiervani wants to merge 2 commits into
Conversation
…sistFingerprinting spoofing (#1305) Firefox's resistFingerprinting (RFP) spoofs navigator.platform to "Win32" on all OSes, causing isWindows() to return true on Linux. This activates the Windows-specific AltGr key buffering logic, which combined with RFP's ~100ms timestamp precision reduction makes the 3ms AltGr timing check unreliable, potentially swallowing or misrouting key events during password entry. Fix: 1. Use navigator.userAgentData?.platform (User-Agent Client Hints API) when available (Chromium browsers). This API is not affected by RFP. 2. For Firefox/Safari (no userAgentData), detect RFP by checking if both Date.now() and performance.timeOrigin are clamped to 100ms boundaries. When RFP is detected, don't trust the spoofed platform value and return false, disabling the unreliable AltGr workaround.
…tFingerprinting (#1305)
terryrankine
added a commit
to terryrankine/kvm
that referenced
this pull request
May 7, 2026
…ingerprinting Applies jetkvm#1344 adapted for the Luckfox fork architecture. Firefox with resistFingerprinting suppresses standalone modifier keydown/keyup events: pressing Shift+A fires only KeyA with shiftKey=true, never a preceding ShiftLeft keydown. Adds `reconcileModifiers()` in useKeyboardEvents.ts, called from keyDownHandler after the existing modifier filter. It walks e.shiftKey/ctrlKey/altKey/metaKey and injects the corresponding Left-side HID modifier code into the active set if the flag is true but the modifier is not yet tracked — skipping the case where the current event itself is that modifier key (handled by the normal path). The keyup path is already correct: handleModifierKeys strips modifiers whose flag is false. The upstream also patched isWindows() to detect RFP-spoofed navigator.platform, but that function is unused in this fork (no AltGr buffering logic), so it was not ported. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
resistFingerprintingsuppresses standalone modifier key events (Shift, Ctrl, Alt, Meta keydown/keyup never fire), causing uppercase letters and modified keys to be sent as unmodifiede.shiftKey/e.ctrlKey/e.altKey/e.metaKeyboolean properties after each keydown/keyup and synthesizes missing modifier press/release eventsisWindows()detection to avoid RFP spoofingnavigator.platformto "Win32", which incorrectly activated AltGr buffering on non-Windows systemsCloses #1305