script.window.js (2606B)
1 // META: script=helper.js 2 3 // 4 // Validate signature-based SRI's interaction between signed script responses 5 // and `<script integrity>` assertions. 6 // 7 8 generate_script_test(kUnsignedShouldExecute, "", EXPECT_LOADED, 9 "No signature, no integrity check: loads."); 10 11 generate_script_test(kUnsignedShouldExecute, "ed25519-???", EXPECT_LOADED, 12 "No signature, malformed integrity check: loads."); 13 14 generate_script_test(kUnsignedShouldBlock, `ed25519-${kValidKeys['rfc']}`, EXPECT_BLOCKED, 15 "No signature, integrity check: blocked."); 16 17 // Should load: 18 generate_script_test(kSignedShouldExecute, "", EXPECT_LOADED, 19 "Valid signature, no integrity check: loads."); 20 generate_script_test(kSignedShouldExecute, "ed25519-???", EXPECT_LOADED, 21 "Valid signature, malformed integrity check: loads."); 22 generate_script_test(kSignedShouldExecute, `ed25519-${kValidKeys['rfc']}`, EXPECT_LOADED, 23 "Valid signature, valid integrity check: loads."); 24 generate_script_test(kSignedShouldExecute, `ed25519-${kValidKeys['rfc']} ed25519-${kValidKeys['arbitrary']}`, EXPECT_LOADED, 25 "Valid signature, one matching integrity check: loads."); 26 27 // Should block: 28 generate_script_test(kSignedShouldBlock, `ed25519-${kValidKeys['arbitrary']}`, EXPECT_BLOCKED, 29 "Valid signature, mismatched integrity check: blocked."); 30 31 // Executable and non-executable scripts signed with RFC's test key and the arbitrary key: 32 generate_script_test(kMultiplySignedShouldExecute, "", EXPECT_LOADED, 33 "Valid signatures, no integrity check: loads."); 34 generate_script_test(kMultiplySignedShouldExecute, "ed25519-???", EXPECT_LOADED, 35 "Valid signatures, malformed integrity check: loads."); 36 generate_script_test(kMultiplySignedShouldExecute, `ed25519-${kValidKeys['rfc']}`, EXPECT_LOADED, 37 "Valid signatures, integrity check matches one: loads."); 38 generate_script_test(kMultiplySignedShouldExecute, `ed25519-${kValidKeys['arbitrary']}`, EXPECT_LOADED, 39 "Valid signatures, integrity check matches the other: loads."); 40 generate_script_test(kMultiplySignedShouldExecute, `ed25519-${kValidKeys['rfc']} ed25519-${kValidKeys['arbitrary']}`, EXPECT_LOADED, 41 "Valid signatures, integrity check matches both: loads."); 42 43 // Should block: 44 generate_script_test(kMultiplySignedShouldBlock, `ed25519-${kInvalidKey}`, EXPECT_BLOCKED, 45 "Valid signatures, integrity check matches neither: blocked.");