-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add a javascript:
URL navigation test which checks the parent's snapshotted CSP is checked during task creation, not during task execution
#49403
Conversation
… was snapshotted Preparation for fixing <whatwg/html#4651>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clever work here at creating a deterministic test for the differences in approaches. I might have spotted a bug, or maybe I just managed to confuse myself...
content-security-policy/navigation/javascript-url-navigation-to-child-snapshots-parent-csp.html
Outdated
Show resolved
Hide resolved
content-security-policy/navigation/javascript-url-navigation-to-child-snapshots-parent-csp.html
Outdated
Show resolved
Hide resolved
…tion, not during task execution
javascript:
URL navigation test which checks the parent's CSP was snapshottedjavascript:
URL navigation test which checks the parent's snapshotted CSP is checked during task creation, not during task execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great strategy! I will approve since I think the things I found do not affect test correctness. But let me know if you want another double-check after changing those.
...vigation/javascript-url-navigation-to-child-checks-snapshotted-csp-during-task-creation.html
Outdated
Show resolved
Hide resolved
const iframe = document.getElementById("iframe"); | ||
iframe.contentWindow.location.href = "javascript:parent.f()"; | ||
addCSP(); | ||
iframe.contentWindow.location.href = "javascript:g()"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the iframe necessary or helpful here anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it ensures the parent's CSP is checked.
A separate test for checking the target's CSP is needed. The desired behavior for that is unclear to me, given whatwg/html#4651 (comment). I'll test locally and open a separate PR.
@domenic: the test is still wrong. It may pass erroneously, because: doesn't necessarily immediately schedule a task for a "securitypolicyviolation". If the snapshotted CSP is checked during task execution, a task for "javascript-h" will be scheduled. In that case the behavior is:
So the the order of e1, e2 would let the test pass. Potentially a fix is to change https://github.com/web-platform-tests/wpt/pull/49403/files#diff-7827e8417fc230100eb3bf6171e46dc9330bafb73831ff7c1234d40709ab1474R17 |
I traced through the spec for We then go in-parallel. The request gets created in https://html.spec.whatwg.org/#create-navigation-params-by-fetching ... and we run into whatwg/html#10796 , ugh. So it's not even well-defined what CSP is consulted. I'll comment over there, but, this is discouraging. |
Preparation for fixing whatwg/html#4651.