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

[bug] This document requires 'TrustedScript' assignment. #1

Open
root0x0 opened this issue Nov 18, 2020 · 4 comments
Open

[bug] This document requires 'TrustedScript' assignment. #1

root0x0 opened this issue Nov 18, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@root0x0
Copy link

root0x0 commented Nov 18, 2020

when you browser some websites. which contains an iframe dynamically loaded by javascript. It will throw an error This document requires 'TrustedScript' assignment.

@filedescriptor
Copy link
Owner

What URL does the iframe load? It doesn't work with data: but should be fine with any other.

@root0x0
Copy link
Author

root0x0 commented Nov 18, 2020

I think is javascript:
屏幕快照 2020-11-18 下午7 51 00

@filedescriptor
Copy link
Owner

I was able to reproduce the behavior described. The sequence of loading a javascript: URL in an iframe is like this:

  1. <iframe src=about:blank>
  2. Navigates it to the javascript: URL

The content script of Untrusted Types is configured with match_about_blank so it is injected for <iframe src=about:blank>, but the navigation happens too fast so the injected JavaScript doesn't have a chance to run.

I'll investigate if it's possible to ensure the JavaScript has run before injecting the meta tag.

@filedescriptor
Copy link
Owner

Actually forget what I said. It's quite the opposite. Chrome doesn't inject content scripts for <iframe src=javascript:> .The iframe, since is on the same origin, inherits the parent's CSP settings. Hence it doesn't have a default policy. I'm not sure if it's fixable but I'll keep investigating.

@filedescriptor filedescriptor added the bug Something isn't working label Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants