Repository navigation
test(persist): regression test for prototype pollution safety during rehydration #3599
Unanswered
ARYAN-DUTT
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi team! 👋
I was reviewing the
persistmiddleware rehydration logic and noticed there isn't an explicit regression test verifying that storage payloads containing a__proto__key do not cause prototype pollution.While Zustand's object spread merge implementation (
{ ...currentState, ...(persistedState as object) }) is already safe against prototype pollution, having an explicit regression test ensures this defensive behavior is never accidentally regressed in future refactors.I have written a passing test and verified it locally:
Test added in
tests/persistSync.test.tsx:All 23 tests pass,
tsc --noEmitand linters pass cleanly. Would this regression test be welcome in the test suite?All reactions