XSS
iframe
allow-downloads-without-user-activation
: Allows for downloads to occur without a gesture from the user.allow-forms
: Allows the resource to submit forms. If this keyword is not used, form submission is blocked.allow-modals
: Lets the resource open modal windows.allow-orientation-lock
: Lets the resource lock the screen orientation.allow-pointer-lock
: Lets the resource use the Pointer Lock API.allow-popups
: Allows popups (such as window.open(), target="_blank", or showModalDialog()). If this keyword is not used, the popup will silently fail to open.allow-popups-to-escape-sandbox
: Lets the sandboxed document open new windows without those windows inheriting the sandboxing. For example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to.allow-presentation
: Lets the resource start a presentation session.allow-same-origin
: If this token is not used, the resource is treated as being from a special origin that always fails the same-origin policy.allow-scripts
: Lets the resource run scripts (but not create popup windows).allow-storage-access-by-user-activation
: Lets the resource request access to the parent’s storage capabilities with the Storage Access API.allow-top-navigation
: Lets the resource navigate the top-level browsing context (the one named _top).allow-top-navigation-by-user-activation
: Lets the resource navigate the top-level browsing context, but only if initiated by a user gesture.
Notes about sandboxing:
- When the embedded document has the same origin as the embedding page, it is strongly discouraged to use both allow-scripts and allow-same-origin, as that lets the embedded document remove the sandbox attribute — making it no more secure than not using the sandbox attribute at all.
- Sandboxing is useless if the attacker can display content outside a sandboxed iframe — such as if the viewer opens the frame in a new tab. Such content should be also served from a separate origin to limit potential damage.
- The sandbox attribute is unsupported in Internet Explorer 9 and earlier.
<iframe
class="wechat-work-iframe"
src=""
frameborder="0"
sandbox="allow-scripts allow-top-navigation allow-same-origin"
scrolling="no">
</iframe>
[1] https://owasp.org/www-project-top-ten/
[2] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe