Skip to content

Conversation

@juliandescottes
Copy link
Contributor

This adds test cases for script commands bypassing CSP.
See w3c/webdriver-bidi#1024

""",
"window.inlineScriptEval()",
"window.preloadScriptEval()",
"window.document.body.onclick()",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this fail if the CSP disallows eval? In other words, if I am testing that my CSP works, I want this to fail, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deciding this is the goal of the discussion in w3c/webdriver-bidi#1024

This test covers all the scenarios I could think about regarding eval/new Function usage from BiDi. At the moment Firefox fails all of them, and Chrome passes all of them except for the async use cases.

But I agree with you and I think it would be better if scripts defined in the content page were not allowed to bypass CSP, even if they are called from a WebDriver BiDi evaluated script. So both window.inlineScriptEval and window.document.body.onclick should fail IMO.

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

Successfully merging this pull request may close these issues.

2 participants