Skip to content

bug: localStorage writes unsanitised for BigInt/circular values #432

Description

@nanaf6203-bit

Summary

Many localStorage writes stringify non-string values without verifying types, causing JSON.stringify to throw on circular refs or BigInts.

Affected area

  • src/lib/cacheManager.ts (queue, cache config)
  • src/lib/propertyCache.ts (propchain-search-cache)
  • src/store/portfolioStore.ts
  • src/components/dashboard/DraggablePropertiesList.tsx

Steps to reproduce / impact

If a BigInt sneaks into the saved value, JSON.stringify throws and the cache silently fails to persist. In DraggablePropertiesList, an unsorted ordering can persist via the failure path.

Expected behaviour

Wrap writers in a typed helper that sanitises values (BigInt → string, Reviver/Replacer pair) and uses the existing structured logger on failure.

Acceptance criteria

  • Centralise localStorage writes in a small typed module.
  • Add TypeScript types for each saved shape.
  • Add unit tests for fail-safe paths.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working correctlypriority/p2P2 — medium priorityrefactorCode health / refactor (no behaviour change)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions