CodeVetter · Repo Unpack · Risk map
pmndrs/zustand
The material boundaries inspected are persisted data, browser-extension messages, server store ownership, and synchronous update propagation. These are source observations and explicitly identified hypotheses, not confirmed vulnerabilities. Packaging and examples also expose verification limits; the bounded inspection does not establish whole-repository absence of other sensitive paths.
- The persistence default writes the whole state to localStorage through JSON serialization; applications must use partialize or an appropriate adapter when state contains data that should not be stored there.
- Stored JSON is parsed and type-asserted without runtime schema validation; default hydration spreads persisted values over current state, so validation and domain-specific merge behavior belong at the adapter/migration/merge boundary.
- Persistence updates live state before setItem; a serialization or storage-write failure occurs after the in-memory update, with no rollback in these wrappers.
- Hydration generations prevent stale hydration application, but default merge still overwrites concurrent edits to stored keys; the test titled 'should not overwrite user state changes' actually expects count 100 to become 42.
- DevTools receives full state snapshots and accepts incoming state-changing messages; production-default disabling and JSON parse error handling do not provide application-state schema validation.
- The Next.js guide requires per-request stores and warns against RSC access to shared stores; unstable_ssrSafe rejects SSR writes but does not itself create request isolation.
- Hypothesis: a throwing synchronous listener can interrupt later listener notifications after state has already changed, because setState calls listeners.forEach without per-listener exception isolation. (inferred)
- Verification limits include a development-only built-package matrix and root checks that exclude examples; demo declares Zustand ^4.3.9 while the library is 5.0.15, so its behavior cannot establish current-source parity.