#1082: Start hardening wallet session hydrate against malformed storage - #1160
Closed
Ajibose wants to merge 2 commits into
Closed
#1082: Start hardening wallet session hydrate against malformed storage#1160Ajibose wants to merge 2 commits into
Ajibose wants to merge 2 commits into
Conversation
Small first step toward LabsCrypt#1082. Full try/catch error boundary around hydrate, clearing invalid stored sessions, and the regression test still need to be added in a follow-up.
The existing "malformed session" test only covered valid JSON with an unexpected shape. This adds a case with unparsable JSON to exercise the JSON.parse catch path in readStoredSession, confirming hydrate falls back to a clean disconnected state and clears the bad key. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
appreciate the intent, but main's readStoredSession already wraps JSON.parse in try/catch, validates the shape via isWalletSession and clears the bad key, so the hardening from #1082 is already in place. the only behavioral delta here is a trim() path that returns null without clearing the stored value, which is slightly worse than the existing catch path. closing. your regression test would pass against main as-is, so a tiny test-only PR is welcome. if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0 |
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 #1082
Summary
localStoragevalue beforeJSON.parseinreadStoredSessionNot yet done
wallet-context.test.tsxwith a malformed stored sessionTest plan
flowfi.wallet.session.v1in localStorage and confirm app doesn't crash