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

Investigate Iframe Script Sandboxing #131

Open
harlan-zw opened this issue Jul 6, 2024 · 0 comments
Open

Investigate Iframe Script Sandboxing #131

harlan-zw opened this issue Jul 6, 2024 · 0 comments

Comments

@harlan-zw
Copy link
Collaborator

harlan-zw commented Jul 6, 2024

Context: https://web.dev/articles/sandboxed-iframes

We can have scripts load from a separate endpoint inside an iframe, allowing us to easily restrict their behaviour. This solves the security concern of using third-party scripts if the remote script is compromised, however it would only make sense for a subset of scripts.

<iframe sandbox="allow-scripts" src="/__scripts/my-script.html"></iframe>

/__scripts/my-script.html

<html>
   <script src="https://example.com/my-script.js"></script>
</html>

Twitter example

<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
    src="https://platform.twitter.com/widgets/tweet_button.html"
    style="border: 0; width:130px; height:20px;"></iframe>
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

No branches or pull requests

1 participant