Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 4 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /subresource-integrity/signatures/tentative/accept-signature.parser-inserted.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<!--
The following tests replicate the requests made in
`accept-signature.window.js`, but do so via script blocks inline in the HTML
document. Some user agents have different loading paths for parser-initiated
scripts and scripts inserted via other scripts, and we should verify both.
-->
<!--
{
integrity: `ed25519-${kValidKeys['rfc']}`,
header: `sig0=("unencoded-digest";sf);keyid="${kValidKeys['rfc']}";tag="sri"`,
}
-->
<script integrity="ed25519-JrQLj5P/89iXES9+vFgrIy29clF9CC/oPPsw3c5D0bs="
src="/subresource-integrity/signatures/accept-signature-script.py?header=sig0%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22JrQLj5P%2F89iXES9%2BvFgrIy29clF9CC%2FoPPsw3c5D0bs%3D%22%3Btag%3D%22sri%22&counter=1"
id="test1"
></script>
<script>
test(_ => {
let matched = document.querySelector(`#test1`).getAttribute('matched');
assert_equals(matched, 'true');
}, "Single, valid integrity assertion.");
</script>
<!--
{
integrity: `ed25519-${kValidKeys['rfc']} malformed-thing`,
header: `sig0=("unencoded-digest";sf);keyid="${kValidKeys['rfc']}";tag="sri"`,
}
-->
<script integrity="ed25519-JrQLj5P/89iXES9+vFgrIy29clF9CC/oPPsw3c5D0bs= malformed-thing"
src="/subresource-integrity/signatures/accept-signature-script.py?header=sig0%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22JrQLj5P%2F89iXES9%2BvFgrIy29clF9CC%2FoPPsw3c5D0bs%3D%22%3Btag%3D%22sri%22&counter=2"
id="test2"
></script>
<script>
test(_ => {
let matched = document.querySelector(`#test2`).getAttribute('matched');
assert_equals(matched, 'true');
}, "One matching + malformed integrity assertion.");
</script>
<!--
{
integrity: `ed25519-${kValidKeys['arbitrary']} ed25519-${kValidKeys['rfc']}`,
header: `sig0=("unencoded-digest";sf);keyid="${kValidKeys['arbitrary']}";tag="sri", ` +
`sig1=("unencoded-digest";sf);keyid="${kValidKeys['rfc']}";tag="sri"`,
}
-->
<script integrity="ed25519-xDnP380zcL4rJ76rXYjeHlfMyPZEOqpJYjsjEppbuXE= ed25519-JrQLj5P/89iXES9+vFgrIy29clF9CC/oPPsw3c5D0bs="
src="/subresource-integrity/signatures/accept-signature-script.py?header=sig0%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22xDnP380zcL4rJ76rXYjeHlfMyPZEOqpJYjsjEppbuXE%3D%22%3Btag%3D%22sri%22%2C+sig1%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22JrQLj5P%2F89iXES9%2BvFgrIy29clF9CC%2FoPPsw3c5D0bs%3D%22%3Btag%3D%22sri%22&counter=3"
id="test3"
></script>
<script>
test(_ => {
let matched = document.querySelector(`#test3`).getAttribute('matched');
assert_equals(matched, 'true');
}, "One matching + one mismatching integrity assertion.");
</script>
<!--
{
integrity: `ed25519-${kValidKeys['arbitrary']} malformed-thing ed25519-${kValidKeys['rfc']}`,
header: `sig0=("unencoded-digest";sf);keyid="${kValidKeys['arbitrary']}";tag="sri", ` +
`sig1=("unencoded-digest";sf);keyid="${kValidKeys['rfc']}";tag="sri"`,
}
-->
<script integrity="ed25519-xDnP380zcL4rJ76rXYjeHlfMyPZEOqpJYjsjEppbuXE= malformed-thing ed25519-JrQLj5P/89iXES9+vFgrIy29clF9CC/oPPsw3c5D0bs="
src="/subresource-integrity/signatures/accept-signature-script.py?header=sig0%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22xDnP380zcL4rJ76rXYjeHlfMyPZEOqpJYjsjEppbuXE%3D%22%3Btag%3D%22sri%22%2C+sig1%3D%28%22unencoded-digest%22%3Bsf%29%3Bkeyid%3D%22JrQLj5P%2F89iXES9%2BvFgrIy29clF9CC%2FoPPsw3c5D0bs%3D%22%3Btag%3D%22sri%22&counter=4"
id="test4"
></script>
<script>
test(_ => {
let matched = document.querySelector(`#test4`).getAttribute('matched');
assert_equals(matched, 'true');
}, "One matching + one mismatching + malformed integrity assertion.");
</script>
</body>
</html>