Implement Subresource Integrity

Implemented response validation part of
https://w3c.github.io/webappsec-subresource-integrity/.
Implemented step eighteen of the main fetch. If a request has integrity
metadata, then following steps are performed
*Wait for response body
*If the response does not have a termination reason and response does not
match request’s integrity metadata, set response to a
network error.# Please enter the commit message for your changes. Lines starting
This commit is contained in:
mrnayak 2017-01-08 08:52:18 +05:30
parent 496447a363
commit a3026499f4
19 changed files with 439 additions and 260 deletions

View file

@ -43,6 +43,8 @@ skip: true
skip: false
[referrer-policy]
skip: false
[subresource-integrity]
skip: false
[touch-events]
skip: false
[typedarrays]

View file

@ -9870,18 +9870,12 @@
[HTMLLinkElement interface: attribute nonce]
expected: FAIL
[HTMLLinkElement interface: attribute integrity]
expected: FAIL
[HTMLLinkElement interface: attribute referrerPolicy]
expected: FAIL
[HTMLLinkElement interface: document.createElement("link") must inherit property "nonce" with the proper type (5)]
expected: FAIL
[HTMLLinkElement interface: document.createElement("link") must inherit property "integrity" with the proper type (6)]
expected: FAIL
[HTMLLinkElement interface: document.createElement("link") must inherit property "sizes" with the proper type (9)]
expected: FAIL

View file

@ -10116,102 +10116,6 @@
[link.nonce: IDL set to object "test-valueOf"]
expected: FAIL
[link.integrity: typeof IDL attribute]
expected: FAIL
[link.integrity: IDL get with DOM attribute unset]
expected: FAIL
[link.integrity: setAttribute() to ""]
expected: FAIL
[link.integrity: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
expected: FAIL
[link.integrity: setAttribute() to undefined]
expected: FAIL
[link.integrity: setAttribute() to 7]
expected: FAIL
[link.integrity: setAttribute() to 1.5]
expected: FAIL
[link.integrity: setAttribute() to true]
expected: FAIL
[link.integrity: setAttribute() to false]
expected: FAIL
[link.integrity: setAttribute() to object "[object Object\]"]
expected: FAIL
[link.integrity: setAttribute() to NaN]
expected: FAIL
[link.integrity: setAttribute() to Infinity]
expected: FAIL
[link.integrity: setAttribute() to -Infinity]
expected: FAIL
[link.integrity: setAttribute() to "\\0"]
expected: FAIL
[link.integrity: setAttribute() to null]
expected: FAIL
[link.integrity: setAttribute() to object "test-toString"]
expected: FAIL
[link.integrity: setAttribute() to object "test-valueOf"]
expected: FAIL
[link.integrity: IDL set to ""]
expected: FAIL
[link.integrity: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
expected: FAIL
[link.integrity: IDL set to undefined]
expected: FAIL
[link.integrity: IDL set to 7]
expected: FAIL
[link.integrity: IDL set to 1.5]
expected: FAIL
[link.integrity: IDL set to true]
expected: FAIL
[link.integrity: IDL set to false]
expected: FAIL
[link.integrity: IDL set to object "[object Object\]"]
expected: FAIL
[link.integrity: IDL set to NaN]
expected: FAIL
[link.integrity: IDL set to Infinity]
expected: FAIL
[link.integrity: IDL set to -Infinity]
expected: FAIL
[link.integrity: IDL set to "\\0"]
expected: FAIL
[link.integrity: IDL set to null]
expected: FAIL
[link.integrity: IDL set to object "test-toString"]
expected: FAIL
[link.integrity: IDL set to object "test-valueOf"]
expected: FAIL
[link.referrerPolicy: typeof IDL attribute]
expected: FAIL

View file

@ -17610,99 +17610,3 @@
[script.nonce: IDL set to object "test-valueOf"]
expected: FAIL
[script.integrity: typeof IDL attribute]
expected: FAIL
[script.integrity: IDL get with DOM attribute unset]
expected: FAIL
[script.integrity: setAttribute() to ""]
expected: FAIL
[script.integrity: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
expected: FAIL
[script.integrity: setAttribute() to undefined]
expected: FAIL
[script.integrity: setAttribute() to 7]
expected: FAIL
[script.integrity: setAttribute() to 1.5]
expected: FAIL
[script.integrity: setAttribute() to true]
expected: FAIL
[script.integrity: setAttribute() to false]
expected: FAIL
[script.integrity: setAttribute() to object "[object Object\]"]
expected: FAIL
[script.integrity: setAttribute() to NaN]
expected: FAIL
[script.integrity: setAttribute() to Infinity]
expected: FAIL
[script.integrity: setAttribute() to -Infinity]
expected: FAIL
[script.integrity: setAttribute() to "\\0"]
expected: FAIL
[script.integrity: setAttribute() to null]
expected: FAIL
[script.integrity: setAttribute() to object "test-toString"]
expected: FAIL
[script.integrity: setAttribute() to object "test-valueOf"]
expected: FAIL
[script.integrity: IDL set to ""]
expected: FAIL
[script.integrity: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
expected: FAIL
[script.integrity: IDL set to undefined]
expected: FAIL
[script.integrity: IDL set to 7]
expected: FAIL
[script.integrity: IDL set to 1.5]
expected: FAIL
[script.integrity: IDL set to true]
expected: FAIL
[script.integrity: IDL set to false]
expected: FAIL
[script.integrity: IDL set to object "[object Object\]"]
expected: FAIL
[script.integrity: IDL set to NaN]
expected: FAIL
[script.integrity: IDL set to Infinity]
expected: FAIL
[script.integrity: IDL set to -Infinity]
expected: FAIL
[script.integrity: IDL set to "\\0"]
expected: FAIL
[script.integrity: IDL set to null]
expected: FAIL
[script.integrity: IDL set to object "test-toString"]
expected: FAIL
[script.integrity: IDL set to object "test-valueOf"]
expected: FAIL

View file

@ -0,0 +1,36 @@
[subresource-integrity.sub.html]
type: testharness
expected: TIMEOUT
[Style: <crossorigin='anonymous'> with correct hash, ACAO: *]
expected: FAIL
[Style: Same-origin with correct sha256 and sha512 hash, rel='alternate stylesheet' enabled]
expected: NOTRUN
[Style: Same-origin with incorrect sha256 and sha512 hash, rel='alternate stylesheet' enabled]
expected: NOTRUN
[Style: Same-origin with incorrect hash.]
expected: FAIL
[Style: Same-origin with sha256 match, sha512 mismatch]
expected: FAIL
[Style: <crossorigin='use-credentials'> with correct hash, CORS-eligible]
expected: FAIL
[Style: <crossorigin='anonymous'> with CORS-ineligible resource]
expected: FAIL
[Style: Cross-origin, not CORS request, with correct hash]
expected: FAIL
[Style: Cross-origin, not CORS request, with hash mismatch]
expected: FAIL
[Style: <crossorigin='use-credentials'> with incorrect hash CORS-eligible]
expected: FAIL
[Style: <crossorigin='anonymous'> with incorrect hash, ACAO: *]
expected: FAIL