fix: add allow-downloads
to iframes
#1054
Merged
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.
What kind of change does this pull request introduce?
Add the
sandbox="allow-downloads"
attribute to iframes. See codesandbox/codesandbox-client#8253 for more context.I'm not 100% sure whether this is the right fix, however:
allow="accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;"
attribute.clipboard-write
is nowhere to be found in thecodesandbox-client
repo. But the value of the attribute literally matches how sandpack sets it.allow-downloads
here will fix the regression for preview sandboxes? 🤔What is the current behavior?
No
allow-downloads
(codesandbox/codesandbox-client#5936), which had been fixed by codesandbox/codesandbox-client#5163 and codesandbox/codesandbox-client#6384 but regressed again.What is the new behavior?
If I understand correctly, updating the code here should fix the issue for sandbox previews (e.g. https://codesandbox.io/p/sandbox/allow-downloads-repro-py27jv).
The new list of sandbox permissions matches the behavior in https://github.com/codesandbox/codesandbox-client/blob/45862c7b9c382abce725f1272c3aed560162776a/packages/common/src/components/Preview/index.tsx#L648
What steps did you take to test this? This is required before we can merge, make sure to test the flow you've updated.
Not sure how to let codesandbox pick up the change here, but unit tests pass. Let me know if I'm on the right path!
Checklist
Documentation;Storybook (if applicable);Tests;