Fix(Keyboard): Mask code field for sensitive inputs in keydown/keyup#9
Merged
Conversation
and remove mask for target element summary
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.
This PR fixes #8 an issue where the
codefield inkeydownandkeyupevents was not masked for sensitive input elements (e.g. password fields, credit card inputs).Related Issue
codefield is not masked for sensitive inputs inkeydown/keyupevents #8Problem
Currently, when a keyboard event occurs on a sensitive element:
key→ correctly masked to[masked]code→ remains unmasked (e.g."KeyA","Digit1")This leaks potentially sensitive interaction patterns despite the
keyvalue being masked.Solution
isSensitive(e.target)check for thecodefieldcodeto[masked]when target is sensitivetargetmasking (keep originalelSummary(e.target)as it's already safe)Changes
handlers.keydown = (e) => record('keydown', { key: isSensitive(e.target) ? '[masked]' : e.key, - code: e.code, - target: isSensitive(e.target) ? '[sensitive]' : elSummary(e.target), + code: isSensitive(e.target) ? '[masked]' : e.code, + target: elSummary(e.target), });Same change applied to the
keyuphandler.Testing
codeis[masked]codeshows actual value (e.g."KeyA")codemaskedtargetfield still contains valid element summaryBreaking Changes
None. This is a bug fix with backward compatible behavior.
Version Change Suggestion
0.2.0→0.2.1(patch)Note
There is only one major version currently (and Telesense is in
0.xinitial development), so no backport is needed until user request.