Repository navigation
feat: wallet security best practices and warnings (#890) - #952
Open
adenueltech wants to merge 1 commit into
Open
adenueltech wants to merge 1 commit into
adenueltech wants to merge 1 commit into
Conversation
- Add src/lib/walletSecurity.ts: security tips, secret key / recovery phrase detection, sliding-window rate limiter, local security event log and suspicious-activity rules - Add WalletSecurityCenter (mounted in layout): security tips after login, warning when a secret key or recovery phrase is typed/pasted, warning on unencrypted (non-HTTPS) connections, suspicious activity alerts - Rate limit wallet connections (5/min) and signing requests (10/min); log failed connects, rejected signatures and account switches - Session timeout: 60s warning with "Stay signed in", clear cached wallet session on lock, configurable timeout in settings - Optional biometric unlock (WebAuthn platform authenticator) - Wallet security section on /settings/security with timeout, biometric toggle, tips and recent security activity Closes Stellar-split#890 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@adenueltech is attempting to deploy a commit to the kingsman-99's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@adenueltech 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 branch has not been deployed
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.
Closes #890
What changed
Show security tips on login
WalletSecurityCenter(mounted once in the root layout) shows a "Keep your wallet safe" dialog the first time a wallet connects in a browser session. The tips cover never sharing secret keys, using an encrypted wallet, reading transactions before signing, checking the network, and locking when away. It includes a "Don't show these tips again" option and a link to security settings.Warn about unencrypted wallets / key exposure
S…, checksum-verified) or a 12–24 word recovery phrase is typed or pasted into any field, a blocking warning explains that StellarSplit never needs it and tells the user to move their funds if it was shared. Password fields are ignored, and nothing is stored: detection only classifies the text.!isSecureContext; localhost is fine).Session timeout
SessionLockProviderand keeps its API, so the existing tests still pass:sessionStorage.stellarsplit_wallet), so a reload requires a fresh connect.setTimeoutMinutes.Biometric authentication (optional)
src/lib/biometric.tsuses WebAuthn with a user-verifying platform authenticator (Touch ID, Face ID, Windows Hello, Android fingerprint). Users can enable it in Settings → Security. When enabled, a locked session needs a biometric check to unlock, or the user can disconnect. The toggle is disabled when the device has no supported sensor.Suspicious activity
recordSecurityEvent) captures failed connections, rejected or failed signatures, account switches, secret-key entry, rate-limit hits and session locks.detectWalletAnomaliesflags patterns in the last 10 minutes, such as 3+ failed connects, 3+ rejected signatures, repeated account switching, or any secret-key exposure. These show as dismissible alerts linking to settings. The settings page lists recent security activity, with a Clear button.Rate limiting
RateLimitErrorwith a "wait Ns" message and are logged as suspicious activity.How I tested
src/__tests__/walletSecurity.test.ts: tips, secret seed and recovery phrase detection (including look-alikes and normal sentences), encrypted-connection check, rate limiter (window sliding, per-key, error), event log (cap of 100, corrupt storage) and every anomaly rule.src/__tests__/SessionLock.test.tsx: all existing tests still pass, plus new tests for the countdown warning, clearing the wallet session on lock, and biometric unlock when enabled.npx tsc --noEmit: 0 errors.next linton changed files: clean.🤖 Generated with Claude Code