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

iframes for query responses can execute scripting #284

Closed
Malvoz opened this issue Feb 9, 2021 · 4 comments · Fixed by #285 or #415
Closed

iframes for query responses can execute scripting #284

Malvoz opened this issue Feb 9, 2021 · 4 comments · Fixed by #285 or #415

Comments

@Malvoz
Copy link
Member

Malvoz commented Feb 9, 2021

CSP Embedded Enforcement (defines the iframe csp attribute) isn't supported by all major browsers, so we fail to prevent scripts from executing in unsupporting browsers. Additionally, scripting is also executed in Chrome due to a bug where about:srcdoc fails to inherit the policy.

There are at least 2 ways to go about blocking scripts with wide support:

  1. Prepend srcdoc with <meta http-equiv="content-security-policy" content="script-src 'none';">
  2. sandbox the iframes

I think option 1 is more straight forward, and doesn't have any further implications other than blocking scripts, if that's what we want to do.

@ahmadayubi
Copy link
Member

Alright I'll implement option 1 in an upcoming PR related to issue #282

@Malvoz
Copy link
Member Author

Malvoz commented Feb 10, 2021

As a side note for option nr. 1, authors of the content inside the iframe can't loosen the policy (to re-enable scripting) by setting their own <meta> CSP, as multiple <meta> CSP policies can only be used to further strengthen an already defined policy (described in https://w3c.github.io/webappsec-csp/#multiple-policies). 👍🏼

@Malvoz
Copy link
Member Author

Malvoz commented Mar 17, 2021

FWIW option 1 (as opposed to option 2) does not block scripts from executing in nested iframes. It would probably be safer to go with option 2...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants