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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add allow-downloads to iframes #1054

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

keyz
Copy link
Contributor

@keyz keyz commented Jan 9, 2024

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:

  • In production, the iframe on https://codesandbox.io/p/sandbox/allow-downloads-repro-py27jv contains the allow="accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;" attribute.
  • The string clipboard-write is nowhere to be found in the codesandbox-client repo. But the value of the attribute literally matches how sandpack sets it.
  • Does it mean sandpack is actually used in production to power sandboxes, therefore adding 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;
  • Ready to be merged;

Copy link

codesandbox bot commented Jan 9, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Jan 9, 2024

@keyz is attempting to deploy a commit to the CodeSandbox Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codesandbox-ci bot commented Jan 9, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit eb2a403:

Sandbox Source
Sandpack Configuration
sandpack-run-stale-value Configuration

@danilowoz danilowoz changed the title Add allow-downloads to iframes fix: add allow-downloads to iframes Jan 10, 2024
@danilowoz danilowoz merged commit c038e13 into codesandbox:main Jan 10, 2024
7 of 11 checks passed
@keyz keyz deleted the iframe-allow-downloads branch January 10, 2024 19:52
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.

2 participants