Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敟 hydrate store using paths #272

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

conor-odro
Copy link

Description

Currently the plugin will restore the entire contents of localStorage or sessionStorage back into the Vue store, regardless of which paths are whitelisted by the paths array. This can result in stale data from a user being put back into the store which should no longer be persisted (i.e in the past the field was included in the paths array but has since been removed) or potentially allows a bad actor to inject their own data into the Vue store (granted this is slightly contrived but could be an issue for some applications).

Linked Issues

#268

Additional context

This has been tested (via Jest) and also locally in my own app. Unsure if we want this to be turned on/off via a config option?

@prazdevs
Copy link
Owner

I would see this as a breaking change because it changes the rehydration behaviour, but i totally see it as a feature/something needed. Maybe keep it being a flag as opt-in to not break the current behaviour, it could eventually become thedefault behaviour on upcoming major version

@conor-odro
Copy link
Author

I would see this as a breaking change because it changes the rehydration behaviour, but i totally see it as a feature/something needed. Maybe keep it being a flag as opt-in to not break the current behaviour, it could eventually become thedefault behaviour on upcoming major version

That's completely fair, appreciate the feedback @prazdevs - I'll update the PR to include an opt-in flag

@conor-odro
Copy link
Author

Hey @prazdevs apologies for the delay in getting around to this - I've updated the PR with a new pathHydration opt-in flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants