This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 144
feat: disable cookie/localstorage access under restricted sandboxes #729
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7f267de
to
d38659d
Compare
@@ -126,9 +123,9 @@ export default class Store extends React.Component { | |||
super(props); | |||
|
|||
if (props.storage_type === 'local') { | |||
this._backstore = _localStore; | |||
this._backstore = new WebStore(window.localStorage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message we get when trying to access localStorage
is fairly informative / helpful:
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': The document is sandboxed and lacks the 'allow-same-origin' flag.
I don't think it needs to be improved to make sense to an app developer and as such can be exposed as-is.
Created plotly/dash#1088 for follow up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegonzalez Looks good. Just need two more things:
- a changelog entry under
## Unreleased
-->### Changed
- a branch update
23372eb
to
39087e2
Compare
When dash is embedded into an iframe with a sandbox attribute that only has allow-scripts, cookie/localstorage access is disabled and dash-core-components fails to load. As such, we need to restrict our cookie/localstorage usage by disabling functionality. This patch moves the disabled functionality to a place where it doesn't get autoloaded regardless of usage, allowing dash-core-components to load in very restricted iframes.
39087e2
to
0aa79e8
Compare
Marc-Andre-Rivet
approved these changes
Jan 15, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
JHSaunders
pushed a commit
to JHSaunders/dash-core-components
that referenced
this pull request
Mar 30, 2020
…lotly#729) When dash is embedded into an iframe with a sandbox attribute that only has allow-scripts, cookie/localstorage access is disabled and dash-core-components fails to load. As such, we need to restrict our cookie/localstorage usage by disabling functionality. This patch moves the disabled functionality to a place where it doesn't get autoloaded regardless of usage, allowing dash-core-components to load in very restricted iframes.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When dash is embedded into an iframe with a sandbox attribute that only has allow-scripts, cookie/localstorage access is disabled and dash-core-components fails to load. As such, we need to restrict our cookie/localstorage usage by disabling functionality.
This patch removes the disabled functionality in a graceful manner, allowing dash-core-components to load in very restricted iframes.