Fix history state navigation security issue #1996
Open
+106
−25
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.
Implements changes proposed in the following comment #1784 (comment) back in May, without the server-side header idea (not against it, though I thought it was out of scope for this, and I didn't want to touch more than I needed to.), and using
window.sessionStorage
instead ofwindow.localStorage
.To summarise the comment and what this PR does
page
cached history from being stored inwindow.history.state
(which cannot be cleared, presenting a potential security issue if private information is stored in page props.), towindow.sessionStorage
, which lives for the lifetime of the tab (though most browsers ignore security concerns by allowing users to restore sessions..) and can be cleared in JS.router.clearHistory()
, for clearing history state.Related tickets/pull-requests:
#1784
#247
#102