-
Notifications
You must be signed in to change notification settings - Fork 83
Conflicting SRI test cases for integrity checks and cross-origin hosts. #728
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
Conflicting SRI test cases for integrity checks and cross-origin hosts. #728
Comments
Tentative WPT PR with the test updates: web-platform-tests/wpt#52850 |
I just realised that the test and algorithm is probably correct after all. While investigating I saw that the Rust CSP crate was missing a check. This weekend I can debug more and confirm whether my current understanding is correct. If so, I will add comments to the test to make it more descriptive of what's going on. |
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo#36760 Fixes servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
My realisation is correct. The test is correct and the specification as well. The reason I got things mixed up, is that the CSP crate was missing the integrity check and then the test started failing in confusing ways. I have added clarifying comments to the test, to make a future reader aware of the nuances of the |
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo#36760 Fixes servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
It was inconsistent with the pre-request check with regards to the handling of `strict-dynamic` in both case-sensitivity and parser metadata. Additionally, add a clarifying comment about why the post-request check also checks the request, to avoid confusion for implementers. Fixes w3c#727 Part of w3c#728
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo#36760 Fixes servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo#36760 Fixes servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes #37200 Closes #36760 Fixes #36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Part of #4577 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe Co-authored-by: Josh Matthews
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812 UltraBlame original commit: e03bfa632ece2cf90574e7b2be50b8f42763bbe7
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812 UltraBlame original commit: e03bfa632ece2cf90574e7b2be50b8f42763bbe7
…es., Automatic update from web-platform-tests net: Perform CSP checks on fetch responses. Also add clarifying comments to the SRI WPT tests with regards to the `www.` domain and how that interacts with the integrity checks. Lastly, adjust the casing for `Strict-Dynamic`, as in the post-request check that should also be case-insensitive. Closes servo/servo#36760 Fixes servo/servo#36499 Part of w3c/webappsec-csp#727 Fixes w3c/webappsec-csp#728 Signed-off-by: Josh MatthewsSigned-off-by: Tim van der Lippe -- wpt-commits: 17e2e028455d9f86ae9a428fccb292b354d89ed6 wpt-pr: 52850 Differential Revision: https://phabricator.services.mozilla.com/D252812 UltraBlame original commit: e03bfa632ece2cf90574e7b2be50b8f42763bbe7
We are implementing the post-request check in Servo: servo/servo#37154 Based on our investigation, no other browser currently implements this check: servo/servo#37154 (comment)
After implementation, we ran into test failures in
tests/wpt/tests/content-security-policy/default-src/default-src-sri_hash.sub.html
. This test appears to verify the various integrity checks. We realized that the domain was wrong, where the test was using{{domain[www]}}
, where the actual current domain is{{domain[]}}
. That fixed a bunch of test cases for us.However, now there are still test failures related to integrity matching. I see that this most recently was changed in #654. If I follow the logic for the following test case:
When we run https://www.w3.org/TR/CSP/#script-post-request on this:
1.2. We don't have a nonce, so continuing
1.3. We don't match integrity (since it is empty/not set)
1.4. We don't have strict-dynamic included
1.5. This response is allowed, since it is a same-origin request (it matches the host)
Hence we run into step 2, where we return allowed.
When I read the test, the intention (and the current browser behavior) is to reject this request. Relevant implementations:
Based on the intention, I thought that #654 was the wrong way around, e.g. it should have been this:
That works for this particular test, but then we get to the actual post-request check failing a different test case:
E.g. this test now does the exact opposite: if the host matches, regardless of the integrity it should load it.
Given that no other browser implements this check yet, I am not sure what the correct behavior should be. I think updating the integrity check to "Does Not Match" is correct, but then what should we do with the crossorigin test case?
The text was updated successfully, but these errors were encountered: