fix(clipboard): add 30-second TTL to clear pasted content from state#716
Open
Vox-d-glitch wants to merge 2 commits into
Open
fix(clipboard): add 30-second TTL to clear pasted content from state#716Vox-d-glitch wants to merge 2 commits into
Vox-d-glitch wants to merge 2 commits into
Conversation
The mobile client had no friction against credential stuffing — failed login attempts were retried immediately via the existing exponential backoff logic designed for network errors, not auth failures. - Store: add authFailureCount, authLockedUntil, refreshFailureCount fields and incrementAuthFailure / resetAuthFailures / incrementRefreshFailure actions to useAppStore; authLockedUntil is persisted to secure storage so a force-close does not bypass the lock - Interceptor: count 401s on /auth/login (increments on each failed attempt, lock triggers at 5); reset counter on successful login response; force-logout after 3 consecutive /auth/refresh 401s - MobileLogin: show amber countdown banner and disable submit button for the 30-second lockout window - Tests: unit tests covering threshold, early-exit, reset-on-success, force-logout at 3 refresh failures, and logout clearing all counters Closes rinafcode#581
|
@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! 🚀 |
Contributor
|
Kindly resolve conflict |
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
authFailureCount,authLockedUntil, andrefreshFailureCountfields touseAppStore;authLockedUntilis persisted to secure storage so a force-close does not reset an active lockoutincrementAuthFailurelocks the login form for 30 seconds and resets the count after 5 consecutive 401s on/auth/login;resetAuthFailuresclears both count and timestamp on successful loginincrementRefreshFailuretracks consecutive/auth/refresh401s and triggers a fulllogout()at 3, preventing a broken auth loopresetAuthFailures()on a successful login response; error interceptor callsincrementAuthFailure()on login 401s andincrementRefreshFailure()on refresh 401sMobileLoginshows an amber countdown banner and disables the submit button for the full 30-second lockout window using a 1-second interval tied toauthLockedUntilType of Change
Testing Done
Security Considerations
authLockedUntilis persisted viasecureStorageJSONStorage(expo-secure-store), not plain AsyncStoragePerformance Considerations
useCallback,useMemo) used appropriately to prevent unnecessary renders? — Lockout state is read via a fine-grained Zustand selector (state => state.authLockedUntil) to avoid unnecessary re-rendersFlatListoptimized (e.g., usinggetItemLayout,keyExtractor)? — N/A to this changeuseEffectcleanup to avoid memory leaks)? — Countdown interval is cleared in theuseEffectcleanup on unmount or whenauthLockedUntilchangesChecklist
Closes #577