Fix security and correctness issues: auth bypass, PIN detection, network drift, timer leak#791
Merged
orbitlumen-hue merged 4 commits intoJul 24, 2026
Conversation
- Move refreshTimer from plain let to useRef so handle survives renders - Add useEffect cleanup to clear interval on unmount - Eliminates duplicate/racing refresh calls from leaked intervals
…gStark#710) - Create src/lib/blockchain/network.ts with getStellarNetwork() and isTestnetNetwork() - Update walletService, blockchain/index, and wallet.tsx to use shared helper - Eliminates duplicate network detection logic and reduces drift risk
…ark#709) - Create DecryptionError class to wrap Web Crypto API failures - Update decryptSecretKey() to catch DOMException and re-throw as DecryptionError - Update WalletRecovery to check instanceof instead of fragile message substrings - Improves reliability across different browsers/implementations
…rk#708) - Create /api/zkp/pet/[petId] route to proxy backend with auth - Update zkpService.getProofsForPet to use internal route instead of direct backend - Attaches auth token consistent with other zkp methods and app patterns
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
Resolves four security and correctness issues across ZKP service, wallet recovery, network detection, and auth token management:
Changes
#708 — zkp.ts getProofsForPet bypasses auth
/api/zkp/pet/[petId]route to proxy backend with authenticationzkpService.getProofsForPet()to route through internal APIgenerateProofandverifyProof#709 — WalletRecovery PIN detection relies on fragile string matching
DecryptionErrorclass for typed error handlingdecryptSecretKey()to wrap Web Crypto API failuresinstanceofcheck inWalletRecovery#710 — Network detection logic duplicated in 3 places
getStellarNetwork()andisTestnetNetwork()tosrc/lib/blockchain/network.tswalletService,blockchain/index, andwallet.tsxto use shared helper#711 — AuthContext token-refresh timer stored in closure variable (HIGH priority)
refreshTimerfrom plainlettouseReffor cross-render persistenceuseEffectcleanup to clear interval on unmountCloses #708, Closes #709, Closes #710, Closes #711