-
Notifications
You must be signed in to change notification settings - Fork 78
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
Integration with document.open() #402
Comments
I stumbled across https://bugs.chromium.org/p/chromium/issues/detail?id=836148 which has some motivation for this behavior. But I don't fully understand it. It seems to me the attacker could just as well append their cc @antosart |
I agree. When designing the policy container inheritance, we though about the I also do not see the security issue with that. CC @mikewest, since I remember discussions on the general question: whether non-html resources in an iframe src (like <iframe src='img.jpg'>) should inherit the parent's CSP, to protect against this sort of problems. |
That approach makes sense to me, @antosart. For |
Right, that follows from https://html.spec.whatwg.org/#navigate-media (well, its caller). I suspect that websites will indeed forget to set headers on such responses at times, but I'm not convinced we want to make that our problem as inheritance is hardly simple. |
Okay, so what remains here is some tests that |
I think web platform tests for this actually already exist: https://github.com/web-platform-tests/wpt/blob/master/content-security-policy/inheritance/document-write-iframe.html |
Thanks, those look good. |
Currently, CSP does not integrate with
document.open()
at all, though user agents already do so. The crux here is that while CSP uses responses as the main object for information of page load,document.open()
does not touch the network at all and hence does not have a response to pass into CSP algorithms.. @andypaicu listed out some things that are necessary for such an integration in whatwg/html#4510 (comment):… except all of these are TODOs for CSP rather than for HTML. In particular, the proposed
initialize-document-csp-from-document
hook already exists in implementations in some form.The text was updated successfully, but these errors were encountered: