fix(clipboard): add 30-second TTL to clear pasted content from state#715
Open
Vox-d-glitch wants to merge 1 commit into
Open
fix(clipboard): add 30-second TTL to clear pasted content from state#715Vox-d-glitch wants to merge 1 commit into
Vox-d-glitch wants to merge 1 commit into
Conversation
Clipboard content held in JS heap memory is a security risk on iOS 16+ and Android 12+, where reads also trigger a visible system toast. A 30-second useEffect timeout now nullifies clipboardContent automatically, with proper cleanup on unmount. No clipboard data is forwarded to loggers or analytics. Adds a fake-timer unit test asserting the auto-clear.
|
@Vox-d-glitch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Clipboard content held in JS heap memory is a security risk on iOS 16+ and Android 12+, where reads also trigger a visible system toast. A 30-second useEffect timeout now nullifies
clipboardContentautomatically, with proper cleanup on unmount. No clipboard data is forwarded to loggers or analytics. Adds a fake-timer unit test asserting the auto-clear.Closes #581
Summary
useEffectinuseOptimizedClipboardthat callssetClipboardContent(null)after pasted content is stored, reducing the in-memory exposure window for passwords, auth tokens, and payment card numbersclipboardTtlRefcleanup runs on unmount and on each re-paste, ensuring no timer leakclipboardContenttype updated fromstringtostring | null; initial value changed from''tonullappLoggeror Sentry —clipboardServicelogs only byte countsjest.useFakeTimers()that assertsclipboardContentisnullafterjest.advanceTimersByTime(30_000)Type of Change
Testing Done
Security Considerations
clipboardServicelogs only character counts, never contentPerformance Considerations
useCallback,useMemo) used appropriately to prevent unnecessary renders? — N/A to this changeFlatListoptimized (e.g., usinggetItemLayout,keyExtractor)? — N/A to this changeuseEffectcleanup to avoid memory leaks)? —clearTimeoutis called in both the TTL effect cleanup and the unmount effect, preventing stale state updates after unmountChecklist