Problem/Motivation

See https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Stru... under the "Always use the sandbox attribute" sandbox:

Always use the sandbox attribute

You want to give attackers as little power as you can to do bad things on your website, therefore you should give embedded content only the permissions needed for doing its job. Of course, this applies to your own content, too. A container for code where it can be used appropriately — or for testing — but can't cause any harm to the rest of the codebase (either accidental or malicious) is called a sandbox.

Content that's not sandboxed may be able to execute JavaScript, submit forms, trigger popup windows, etc. By default, you should impose all available restrictions by using the sandbox attribute with no parameters, as shown in our previous example.

If absolutely required, you can add permissions back one by one (inside the sandbox="" attribute value) — see the sandbox reference entry for all the available options. One important note is that you should never add both allow-scripts and allow-same-origin to your sandbox attribute — in that case, the embedded content could bypass the Same-origin policy that stops sites from executing scripts, and use JavaScript to turn off sandboxing altogether.

Note: Sandboxing provides no protection if attackers can fool people into visiting malicious content directly (outside an iframe). If there's any chance that certain content may be malicious (e.g., user-generated content), please serve it from a different domain to your main site.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

grevil created an issue. See original summary.

anybody’s picture

Category: Task » Feature request
Issue summary: View changes

Maybe we should make this a setting, enabled by default? So the site manager can control it.

anybody’s picture

Yeah maybe we even need a further setting for the optional contents of the attribute (just a textfield)?

  • grevil committed 3f1066f0 on 1.0.x
    Add information about the iframe "sandbox" property in the README. (...
grevil’s picture

Status: Active » Fixed

We are not generating the iframes in this module. This module simply provides content to render inside iframes by third party sites.

I created information noticing the user about the usage of "sandbox" in the README file.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.