From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../script-src/10_1_support_1.js | 4 + .../script-src/10_1_support_2.js | 5 + .../addInlineTestsWithDOMManipulation.js | 28 +++ .../script-src/buildInlineWorker.js | 21 +++ .../script-src/crossoriginScript.js | 3 + .../script-src/crossoriginScript.js.headers | 1 + ...lowed-in-report-only-mode-and-sends-report.html | 19 ++ ...ort-only-mode-and-sends-report.html.sub.headers | 2 + .../eval-allowed-in-report-only-mode.html | 17 ++ ...al-allowed-in-report-only-mode.html.sub.headers | 1 + .../script-src/externalScript.js | 1 + .../hash-always-converted-to-utf-8/iso-8859-1.html | 20 ++ .../iso-8859-1.html.sub.headers | 1 + .../hash-always-converted-to-utf-8/iso-8859-3.html | 20 ++ .../iso-8859-3.html.sub.headers | 1 + .../hash-always-converted-to-utf-8/iso-8859-7.html | 20 ++ .../iso-8859-7.html.sub.headers | 1 + .../hash-always-converted-to-utf-8/iso-8859-9.html | 20 ++ .../iso-8859-9.html.sub.headers | 1 + .../utf-8-lone-surrogate.html | 31 ++++ .../utf-8-lone-surrogate.html.sub.headers | 1 + .../hash-always-converted-to-utf-8/utf-8.html | 36 ++++ .../utf-8.html.sub.headers | 1 + .../injected-inline-script-allowed.sub.html | 24 +++ .../injected-inline-script-blocked.sub.html | 25 +++ .../script-src/inlineSuccessTest.js | 12 ++ .../script-src/inlineTests.js | 22 +++ .../script-src/javascript-window-open-blocked.html | 20 ++ ...javascript-window-open-blocked.html.sub.headers | 6 + .../script-src/nonce-enforce-blocked.html | 63 +++++++ .../script-src/script-src-1_1.html | 20 ++ .../script-src/script-src-1_10.html | 31 ++++ .../script-src/script-src-1_10_1.html | 19 ++ .../script-src/script-src-1_2.html | 20 ++ .../script-src/script-src-1_2_1.html | 21 +++ .../script-src/script-src-1_3.html | 18 ++ .../script-src/script-src-1_4.html | 28 +++ .../script-src/script-src-1_4_1.html | 33 ++++ .../script-src/script-src-1_4_2.html | 31 ++++ ...tiple-policies-multiple-hashing-algorithms.html | 26 +++ ...es-multiple-hashing-algorithms.html.sub.headers | 6 + ...iple-policies-one-using-hashing-algorithms.html | 26 +++ ...s-one-using-hashing-algorithms.html.sub.headers | 6 + .../script-src-overrides-default-src.sub.html | 27 +++ ...nly-policy-works-with-external-hash-policy.html | 25 +++ ...orks-with-external-hash-policy.html.sub.headers | 6 + ...-report-only-policy-works-with-hash-policy.html | 31 ++++ ...-policy-works-with-hash-policy.html.sub.headers | 6 + .../script-src/script-src-sri_hash.sub.html | 104 +++++++++++ .../script-src-sri_hash.sub.html.sub.headers | 5 + ...pt-src-strict_dynamic_and_unsafe_eval_eval.html | 31 ++++ ...trict_dynamic_and_unsafe_eval_eval.html.headers | 5 + ...trict_dynamic_and_unsafe_eval_new_function.html | 31 ++++ ...namic_and_unsafe_eval_new_function.html.headers | 5 + ...-strict_dynamic_discard_source_expressions.html | 32 ++++ ...dynamic_discard_source_expressions.html.headers | 5 + ...rict_dynamic_double_policy_different_nonce.html | 68 +++++++ ...amic_double_policy_different_nonce.html.headers | 6 + ...double_policy_honor_source_expressions.sub.html | 61 ++++++ ...olicy_honor_source_expressions.sub.html.headers | 6 + ...c-strict_dynamic_double_policy_report_only.html | 44 +++++ ..._dynamic_double_policy_report_only.html.headers | 6 + .../script-src/script-src-strict_dynamic_eval.html | 38 ++++ .../script-src-strict_dynamic_eval.html.headers | 5 + .../script-src-strict_dynamic_hashes.html | 52 ++++++ .../script-src-strict_dynamic_hashes.html.headers | 5 + .../script-src-strict_dynamic_in_img-src.html | 32 ++++ ...ript-src-strict_dynamic_in_img-src.html.headers | 5 + .../script-src-strict_dynamic_javascript_uri.html | 32 ++++ ...-src-strict_dynamic_javascript_uri.html.headers | 5 + .../script-src-strict_dynamic_meta_tag.html | 76 ++++++++ ...script-src-strict_dynamic_meta_tag.html.headers | 4 + .../script-src-strict_dynamic_new_function.html | 37 ++++ ...pt-src-strict_dynamic_new_function.html.headers | 5 + ...ipt-src-strict_dynamic_non_parser_inserted.html | 76 ++++++++ ...strict_dynamic_non_parser_inserted.html.headers | 5 + ...ynamic_non_parser_inserted_incorrect_nonce.html | 29 +++ ...on_parser_inserted_incorrect_nonce.html.headers | 5 + .../script-src-strict_dynamic_parser_inserted.html | 205 +++++++++++++++++++++ ...src-strict_dynamic_parser_inserted.html.headers | 5 + ...rict_dynamic_parser_inserted_correct_nonce.html | 110 +++++++++++ ...amic_parser_inserted_correct_nonce.html.headers | 5 + ...-strict_dynamic_worker-importScripts.https.html | 18 ++ .../script-src-strict_dynamic_worker.https.html | 20 ++ .../script-src-wildcards-disallowed.html | 63 +++++++ .../script-src/scripthash-allowed.sub.html | 42 +++++ ...cripthash-base64url-converts-to-base64.sub.html | 40 ++++ .../scripthash-basic-blocked-error-event.html | 10 + .../script-src/scripthash-basic-blocked.sub.html | 72 ++++++++ .../scripthash-case-insensitive.sub.html | 60 ++++++ .../script-src/scripthash-changed-1.html | 35 ++++ .../script-src/scripthash-changed-2.html | 35 ++++ .../script-src/scripthash-default-src.sub.html | 21 +++ .../scripthash-ignore-unsafeinline.sub.html | 56 ++++++ .../scripthash-unicode-normalization.sub.html | 72 ++++++++ .../script-src/scriptnonce-allowed.sub.html | 68 +++++++ .../script-src/scriptnonce-and-scripthash.sub.html | 79 ++++++++ .../script-src/scriptnonce-basic-blocked.sub.html | 43 +++++ .../script-src/scriptnonce-changed-1.html | 31 ++++ .../script-src/scriptnonce-changed-2.html | 31 ++++ .../scriptnonce-ignore-unsafeinline.sub.html | 74 ++++++++ .../script-src/scriptnonce-redirect.sub.html | 62 +++++++ .../scriptnonce-specified-source.sub.html | 43 +++++ ...riptnonce-specified-source.sub.html.sub.headers | 1 + .../script-src/simpleSourcedScript.js | 1 + .../srcdoc-doesnt-bypass-script-src.sub.html | 35 ++++ .../support/change-scripthash-before-execute.js | 10 + .../support/change-scriptnonce-before-execute.js | 8 + .../script-src/support/empty.css | 0 .../script-src/support/inject-script.js | 5 + .../support/inline-script-should-be-blocked.js | 14 ++ .../script-src/support/post-message.js | 1 + .../script-src/support/worker-eval.js | 5 + .../script-src/support/worker-eval.js.sub.headers | 1 + .../script-src/support/worker-function-function.js | 7 + .../worker-function-function.js.sub.headers | 1 + .../worker-with-script-src-none-importscripts.js | 17 ++ ...th-script-src-none-importscripts.js.sub.headers | 1 + .../worker-with-script-src-none-set-timeout.js | 16 ++ ...with-script-src-none-set-timeout.js.sub.headers | 1 + .../script-src/worker-data-set-timeout.sub.html | 28 +++ .../script-src/worker-eval-blocked.sub.html | 38 ++++ .../worker-function-function-blocked.sub.html | 37 ++++ .../script-src/worker-importscripts.sub.html | 26 +++ .../script-src/worker-script-src.sub.html | 32 ++++ .../script-src/worker-set-timeout.sub.html | 26 +++ 126 files changed, 3238 insertions(+) create mode 100644 testing/web-platform/tests/content-security-policy/script-src/10_1_support_1.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/10_1_support_2.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/addInlineTestsWithDOMManipulation.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/buildInlineWorker.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/externalScript.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-allowed.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-blocked.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/inlineSuccessTest.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/inlineTests.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/nonce-enforce-blocked.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_10.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_10_1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_2.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_2_1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_3.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_4.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_2.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-overrides-default-src.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker-importScripts.https.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker.https.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/script-src-wildcards-disallowed.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-allowed.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-base64url-converts-to-base64.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked-error-event.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-case-insensitive.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-2.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-default-src.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-ignore-unsafeinline.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scripthash-unicode-normalization.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-allowed.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-and-scripthash.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-basic-blocked.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-1.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-2.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-ignore-unsafeinline.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-redirect.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/simpleSourcedScript.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/srcdoc-doesnt-bypass-script-src.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/change-scripthash-before-execute.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/change-scriptnonce-before-execute.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/empty.css create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/inject-script.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/inline-script-should-be-blocked.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/post-message.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js create mode 100644 testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js.sub.headers create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-data-set-timeout.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-eval-blocked.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-function-function-blocked.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-importscripts.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-script-src.sub.html create mode 100644 testing/web-platform/tests/content-security-policy/script-src/worker-set-timeout.sub.html (limited to 'testing/web-platform/tests/content-security-policy/script-src') diff --git a/testing/web-platform/tests/content-security-policy/script-src/10_1_support_1.js b/testing/web-platform/tests/content-security-policy/script-src/10_1_support_1.js new file mode 100644 index 0000000000..9bfe201711 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/10_1_support_1.js @@ -0,0 +1,4 @@ +var dataScriptRan = false; + +var t_spv = async_test("Test that no report violation event was raised"); +window.addEventListener("securitypolicyviolation", t_spv.unreached_func("Should not have raised any securitypolicyviolation event")); \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/10_1_support_2.js b/testing/web-platform/tests/content-security-policy/script-src/10_1_support_2.js new file mode 100644 index 0000000000..ff159db33c --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/10_1_support_2.js @@ -0,0 +1,5 @@ +test(function () { + assert_true(dataScriptRan, "data script ran"); + }, "Verify that data: as script src runs with this policy"); + +t_spv.done(); \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/addInlineTestsWithDOMManipulation.js b/testing/web-platform/tests/content-security-policy/script-src/addInlineTestsWithDOMManipulation.js new file mode 100644 index 0000000000..02c8c8cdd4 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/addInlineTestsWithDOMManipulation.js @@ -0,0 +1,28 @@ +(function () { + var t_spv = async_test("Test that securitypolicyviolation event is fired"); + var test_count = 2; + + window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) { + assert_equals(e.violatedDirective, "script-src-elem"); + if (--test_count <= 0) { + t_spv.done(); + } + })); + + + var dmTest = async_test("DOM manipulation inline tests"); + var attachPoint = document.getElementById('attachHere'); + var inlineScript = document.createElement('script'); + var scriptText = document.createTextNode('dmTest.step(function() {assert_unreached("Unsafe inline script ran - createTextNode.")});'); + + inlineScript.appendChild(scriptText); + attachPoint.appendChild(inlineScript); + + document.getElementById('emptyScript').innerHTML = 'dmTest.step(function() {assert_unreached("Unsafe inline script ran - innerHTML.")});'; + document.getElementById('emptyDiv').outerHTML = ''; + + document.write(''); + document.writeln(''); + + dmTest.done(); +})(); diff --git a/testing/web-platform/tests/content-security-policy/script-src/buildInlineWorker.js b/testing/web-platform/tests/content-security-policy/script-src/buildInlineWorker.js new file mode 100644 index 0000000000..8cd092147c --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/buildInlineWorker.js @@ -0,0 +1,21 @@ +(function () +{ + var workerSource = document.getElementById('inlineWorker'); + var blob = new Blob([workerSource.textContent]); + + // can I create a new script tag like this? ack... + var url = window.URL.createObjectURL(blob); + + try { + var worker = new Worker(url); + } + catch (e) { + done(); + } + + worker.addEventListener('message', function(e) { + assert_unreached("script ran"); + }, false); + + worker.postMessage(''); +})(); diff --git a/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js b/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js new file mode 100644 index 0000000000..08535fa552 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js @@ -0,0 +1,3 @@ +// Identical to simpleSourcedScript.js but with a different hash, thanks to +// this comment! +window.postMessage(document.currentScript.id, "*"); diff --git a/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js.headers b/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js.headers new file mode 100644 index 0000000000..cb762eff80 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/crossoriginScript.js.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html new file mode 100644 index 0000000000..6ee3785dc8 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html.sub.headers new file mode 100644 index 0000000000..09d8adec37 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode-and-sends-report.html.sub.headers @@ -0,0 +1,2 @@ +Set-Cookie: eval-allowed-in-report-only-mode-and-sends-report={{$id:uuid()}}; Path=/content-security-policy/script-src +Content-Security-Policy-Report-Only: script-src 'unsafe-inline' 'self'; report-uri /reporting/resources/report.py?op=put&reportID={{$id}} diff --git a/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html new file mode 100644 index 0000000000..eebc8f026f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html.sub.headers new file mode 100644 index 0000000000..b9b5d81acc --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/eval-allowed-in-report-only-mode.html.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy-Report-Only: script-src 'unsafe-inline' diff --git a/testing/web-platform/tests/content-security-policy/script-src/externalScript.js b/testing/web-platform/tests/content-security-policy/script-src/externalScript.js new file mode 100644 index 0000000000..2920b03c9b --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/externalScript.js @@ -0,0 +1 @@ +externalRan = true; \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html new file mode 100644 index 0000000000..0d0f46fda4 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html.sub.headers new file mode 100644 index 0000000000..acc92f4e80 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-1.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=iso-8859-1 diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html new file mode 100644 index 0000000000..d4a0de41e2 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html.sub.headers new file mode 100644 index 0000000000..ae3e03dae1 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-3.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=iso-8859-3 diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html new file mode 100644 index 0000000000..62876f1e43 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html.sub.headers new file mode 100644 index 0000000000..9550b0de30 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-7.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=iso-8859-7 diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html new file mode 100644 index 0000000000..8c1db6d203 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html.sub.headers new file mode 100644 index 0000000000..6382ff86a7 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/iso-8859-9.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=iso-8859-9 diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html new file mode 100644 index 0000000000..58730a72cc --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html.sub.headers new file mode 100644 index 0000000000..2d1c08b9e8 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8-lone-surrogate.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=utf-8 diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html new file mode 100644 index 0000000000..b770cba246 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html.sub.headers new file mode 100644 index 0000000000..2d1c08b9e8 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/hash-always-converted-to-utf-8/utf-8.html.sub.headers @@ -0,0 +1 @@ +Content-Type: text/html; charset=utf-8 diff --git a/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-allowed.sub.html b/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-allowed.sub.html new file mode 100644 index 0000000000..5a8cdec847 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-allowed.sub.html @@ -0,0 +1,24 @@ + + + + + + + injected-inline-script-allowed + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-blocked.sub.html b/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-blocked.sub.html new file mode 100644 index 0000000000..45b7414890 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/injected-inline-script-blocked.sub.html @@ -0,0 +1,25 @@ + + + + + + + injected-inline-script-blocked + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/inlineSuccessTest.js b/testing/web-platform/tests/content-security-policy/script-src/inlineSuccessTest.js new file mode 100644 index 0000000000..1f0d7ae715 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/inlineSuccessTest.js @@ -0,0 +1,12 @@ +var t_spv = async_test("Should not fire policy violation events"); +window.addEventListener("securitypolicyviolation", t_spv.unreached_func("Should have not fired any securitypolicyviolation event")); + +var inlineRan = false; + +onload = function() { + test(function() { + assert_true(inlineRan, 'Unsafe inline script ran.')}, + 'Inline script in a script tag should run with an unsafe-inline directive' + ); + t_spv.done(); +} \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/inlineTests.js b/testing/web-platform/tests/content-security-policy/script-src/inlineTests.js new file mode 100644 index 0000000000..3c0712b449 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/inlineTests.js @@ -0,0 +1,22 @@ +var t1 = async_test("Inline script block"); +var t2 = async_test("Inline event handler"); + +onload = function() {t1.done(); t2.done();}; + +var t_spv = async_test("Should fire policy violation events"); +var block_event_fired = false; +var handler_event_fired = false; +window.addEventListener("securitypolicyviolation", t_spv.step_func(function(e) { + if (e.violatedDirective == "script-src-elem") { + assert_false(block_event_fired); + block_event_fired = true; + } else if (e.violatedDirective == "script-src-attr") { + assert_false(handler_event_fired); + handler_event_fired = true; + } else { + assert_unreached("Unexpected directive broken"); + } + if (block_event_fired && handler_event_fired) { + t_spv.done(); + } +})); diff --git a/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html b/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html new file mode 100644 index 0000000000..ae4d8227ed --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html @@ -0,0 +1,20 @@ + + + + Window.open should not open javascript url if not allowed. + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html.sub.headers new file mode 100644 index 0000000000..b54c91e74e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/javascript-window-open-blocked.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Set-Cookie: javascript-window-open-blocked={{$id:uuid()}}; Path=/content-security-policy/script-src/ +Content-Security-Policy: script-src 'nonce-abc'; report-uri /reporting/resources/report.py?op=put&reportID={{$id}} diff --git a/testing/web-platform/tests/content-security-policy/script-src/nonce-enforce-blocked.html b/testing/web-platform/tests/content-security-policy/script-src/nonce-enforce-blocked.html new file mode 100644 index 0000000000..25343a5d4d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/nonce-enforce-blocked.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_1.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_1.html new file mode 100644 index 0000000000..d66253c6a1 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_1.html @@ -0,0 +1,20 @@ + + + + Inline script should not run without 'unsafe-inline' script-src directive. + + + + + + +

Inline script should not run without 'unsafe-inline' script-src directive, even for script-src 'self'.

+
+ + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10.html new file mode 100644 index 0000000000..7c1c9f29b6 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10.html @@ -0,0 +1,31 @@ + + + + data: as script src should not run with a policy that doesn't specify data: as an allowed source + + + + + +

data: as script src should not run with a policy that doesn't specify data: as an allowed source

+
+ + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10_1.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10_1.html new file mode 100644 index 0000000000..a1e2f72cdb --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_10_1.html @@ -0,0 +1,19 @@ + + + + data: as script src should run with a policy that specifies data: as an allowed source but not 'unsafe-inline' + + + + + +

data: as script src should run with a policy that specifies data: as an allowed source but not 'unsafe-inline'

+
+ + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2.html new file mode 100644 index 0000000000..a68945cb85 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2.html @@ -0,0 +1,20 @@ + + + + Inline script should not run without 'unsafe-inline' script-src directive. + + + + + + +

Inline script should not run without 'unsafe-inline' script-src directive, even for script-src *.

+
+ + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2_1.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2_1.html new file mode 100644 index 0000000000..2641c867f6 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_2_1.html @@ -0,0 +1,21 @@ + + + + Inline script attached by DOM manipulation should not run without an 'unsafe-inline' script-src policy, even with default-src * + + + + + +

Inline script attached by DOM manipulation should not run without an 'unsafe-inline' script-src policy, even with default-src *

+
+ +
+ + + +
+ + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_3.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_3.html new file mode 100644 index 0000000000..bf7a6921b4 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_3.html @@ -0,0 +1,18 @@ + + + + Positive test case: Inline script should run 'unsafe-inline' script-src directive. + + + + + + +

Positive test case: Inline script should run 'unsafe-inline' script-src directive.

+
+ + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4.html new file mode 100644 index 0000000000..d4e2067f96 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4.html @@ -0,0 +1,28 @@ + + + + eval() should not run without 'unsafe-eval' script-src directive. + + + + + +

eval() should not run without 'unsafe-eval' script-src directive.

+
+ + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_1.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_1.html new file mode 100644 index 0000000000..0eed7a979a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_1.html @@ -0,0 +1,33 @@ + + + + setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive. + + + + + +

setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive.

+
+ + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_2.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_2.html new file mode 100644 index 0000000000..217125df58 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-1_4_2.html @@ -0,0 +1,31 @@ + + + + Function() called as a constructor should throw without 'unsafe-eval' script-src directive. + + + + + +

Function() called as a constructor should throw without 'unsafe-eval' script-src directive.

+
+ + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html new file mode 100644 index 0000000000..70b3145727 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html @@ -0,0 +1,26 @@ + + + + Multiple policies with different hashing algorithms still work. + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html.sub.headers new file mode 100644 index 0000000000..89f99e621f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-multiple-hashing-algorithms.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc'; +Content-Security-Policy: script-src 'sha384-skw7BVxHbmE2umPGMd1kX+ye6qBeHAb875erPoD8ilKv1LkjKR+WFi7N85ORMdhS' 'nonce-abc'; \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html new file mode 100644 index 0000000000..da9e60f874 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html @@ -0,0 +1,26 @@ + + + + Multiple policies some using hashes some not using hashes still work. + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html.sub.headers new file mode 100644 index 0000000000..83fe7f7005 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc'; +Content-Security-Policy: script-src 'self' 'unsafe-inline'; \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-overrides-default-src.sub.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-overrides-default-src.sub.html new file mode 100644 index 0000000000..5a0dfe50e1 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-overrides-default-src.sub.html @@ -0,0 +1,27 @@ + + + + + + + script-src-overrides-default-src + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html new file mode 100644 index 0000000000..3c4e39e825 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html @@ -0,0 +1,25 @@ + + + + A report-only policy that does not allow a script should not affect an enforcing policy using hashes. + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html.sub.headers new file mode 100644 index 0000000000..7f03464d4d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-external-hash-policy.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0=' 'nonce-abc' +Content-Security-Policy-Report-Only: script-src 'nonce-abc'; \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html new file mode 100644 index 0000000000..850f4b2c2e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html @@ -0,0 +1,31 @@ + + + + A report-only policy that does not allow a script should not affect an enforcing policy using hashes. + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html.sub.headers new file mode 100644 index 0000000000..1237c247a6 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-report-only-policy-works-with-hash-policy.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc' +Content-Security-Policy-Report-Only: script-src 'nonce-abc'; \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html new file mode 100644 index 0000000000..b59206824d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html @@ -0,0 +1,104 @@ + + + + + External scripts with matching SRI hash should be allowed. + + + + + + + +

External scripts with matching SRI hash should be allowed.

+
+ + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html.sub.headers new file mode 100644 index 0000000000..25cd6541ac --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-sri_hash.sub.html.sub.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src {{domains[www]}}:* 'nonce-dummy' 'sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0=' 'sha256-L7/UQ9VWpyG7C9RDEC4ctS5hI3Zcw+ta+haPGlByG9c=' 'sha512-rYCVMxWV5nq8IsMo+UZNObWtEiWGok/vDN8BMoEQi41s0znSes6E1Q2aag3Lw3u2J1w2rqH7uF2ws6FpQhfSOA=' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html new file mode 100644 index 0000000000..96ef2496b5 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html @@ -0,0 +1,31 @@ + + + + + Scripts injected via `eval` are allowed with `strict-dynamic` with `unsafe-eval`. + + + + + + + +

Scripts injected via `eval` are allowed with `strict-dynamic` with `unsafe-eval`.

+
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html.headers new file mode 100644 index 0000000000..dc5f30a03a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_eval.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' 'unsafe-eval' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html new file mode 100644 index 0000000000..3041db056f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html @@ -0,0 +1,31 @@ + + + + + Scripts injected via `new Function()` are allowed with `strict-dynamic` with `unsafe-eval`. + + + + + + + +

Scripts injected via `new Function()` are allowed with `strict-dynamic` with `unsafe-eval`.

+
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html.headers new file mode 100644 index 0000000000..dc5f30a03a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_and_unsafe_eval_new_function.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' 'unsafe-eval' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html new file mode 100644 index 0000000000..4edef30109 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html @@ -0,0 +1,32 @@ + + + + + Source expressions are discarded with `strict-dynamic` in the script-src directive. + + + + + + + +

Source expressions are discarded with `strict-dynamic` in the script-src directive.

+
+ + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html.headers new file mode 100644 index 0000000000..8499eb0559 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_discard_source_expressions.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'self' 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html new file mode 100644 index 0000000000..91d12ed7bd --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html @@ -0,0 +1,68 @@ + + + + + A separate policy with more nonces works correctly with `strict-dynamic` in the script-src directive. + + + + + + + +

A separate policy with more nonces works correctly with `strict-dynamic` in the script-src directive.

+
+ + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html.headers new file mode 100644 index 0000000000..63d96aaf1e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_different_nonce.html.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' +Content-Security-Policy: script-src 'nonce-dummy' 'nonce-dummy2' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html new file mode 100644 index 0000000000..39126de58f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html @@ -0,0 +1,61 @@ + + + + + Source expressions in a separate policy are honored with `strict-dynamic` in the script-src directive. + + + + + + + +

Source expressions in a separate policy are honored with `strict-dynamic` in the script-src directive.

+
+ + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html.headers new file mode 100644 index 0000000000..5b4078efd3 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_honor_source_expressions.sub.html.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' +Content-Security-Policy: script-src 'self' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html new file mode 100644 index 0000000000..1ceb74c63d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html @@ -0,0 +1,44 @@ + + + + + A separate Report-Only policy does not influence `strict-dynamic` in the script-src directive. + + + + + + + +

A separate Report-Only policy does not influence `strict-dynamic` in the script-src directive.

+
+ + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html.headers new file mode 100644 index 0000000000..7883f80ef6 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_double_policy_report_only.html.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' +Content-Security-Policy-Report-Only: script-src 'none' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html new file mode 100644 index 0000000000..3a6056f566 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html @@ -0,0 +1,38 @@ + + + + + Scripts injected via `eval` are not allowed with `strict-dynamic` without `unsafe-eval`. + + + + + + + +

Scripts injected via `eval` are not allowed with `strict-dynamic` without `unsafe-eval`.

+
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_eval.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html new file mode 100644 index 0000000000..e4ce1e5944 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html @@ -0,0 +1,52 @@ + + + + + `strict-dynamic` allows scripts matching hashes present in the policy. + + + + + + + +

`strict-dynamic` allows scripts matching hashes present in the policy.

+
+ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html.headers new file mode 100644 index 0000000000..0d824d8b0e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_hashes.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' 'sha256-yU6Q7nD1TCBB9JvY06iIJ8ONLOPU4g8ml5JCDgXkv+M=' 'sha256-EEoi70frWHkGFhK51NVIJkXpq72aPxSCNZEow37ZmRA=' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html new file mode 100644 index 0000000000..29a2a59573 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html @@ -0,0 +1,32 @@ + + + + + `strict-dynamic` does not drop allowed source expressions in `img-src`. + + + + + + + +

`strict-dynamic` does not drop allowed source expressions in `img-src`.

+
+ + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html.headers new file mode 100644 index 0000000000..75a41c9e25 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_in_img-src.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: img-src 'strict-dynamic' 'self' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html new file mode 100644 index 0000000000..f7625afdaf --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html @@ -0,0 +1,32 @@ + + + + + Script injected via `javascript:` URIs are not allowed with `strict-dynamic`. + + + + + + + +

Script injected via `javascript:` URIs are not allowed with `strict-dynamic`.

+
+ + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_javascript_uri.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html new file mode 100644 index 0000000000..fa38b65a23 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html @@ -0,0 +1,76 @@ + + + + + A `strict-dynamic` policy can be served in a META tag. + + + + + + + + +

A `strict-dynamic` policy can be served in a META tag.

+
+ + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html.headers new file mode 100644 index 0000000000..519dcaacb1 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_meta_tag.html.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html new file mode 100644 index 0000000000..263d5d1d87 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html @@ -0,0 +1,37 @@ + + + + + Scripts injected via `new Function()` are not allowed with `strict-dynamic` without `unsafe-eval`. + + + + + + + +

Scripts injected via `new Function()` are not allowed with `strict-dynamic` without `unsafe-eval`.

+
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_new_function.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html new file mode 100644 index 0000000000..63b7a61247 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html @@ -0,0 +1,76 @@ + + + + + Nonced and non parser-inserted scripts should run with `strict-dynamic` in the script-src directive. + + + + + + + +

Nonced and non parser-inserted scripts should run with `strict-dynamic` in the script-src directive.

+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html new file mode 100644 index 0000000000..ac180d23f5 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html @@ -0,0 +1,29 @@ + + + + + Scripts without a correct nonce should not run with `strict-dynamic` in the script-src directive. + + + + + + + +

Scripts without a correct nonce should not run with `strict-dynamic` in the script-src directive.

+
+ + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted_incorrect_nonce.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html new file mode 100644 index 0000000000..c5e33dc425 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html @@ -0,0 +1,205 @@ + + + + + Parser-inserted scripts without a correct nonce are not allowed with `strict-dynamic` in the script-src directive. + + + + + + + +

Parser-inserted scripts without a correct nonce are not allowed with `strict-dynamic` in the script-src directive.

+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html new file mode 100644 index 0000000000..9368089781 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html @@ -0,0 +1,110 @@ + + + + + Parser-inserted scripts with a correct nonce are allowed with `strict-dynamic` in the script-src directive. + + + + + + + +

Parser-inserted scripts with a correct nonce are allowed with `strict-dynamic` in the script-src directive.

+
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html.headers b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html.headers new file mode 100644 index 0000000000..b7918c9332 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted_correct_nonce.html.headers @@ -0,0 +1,5 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Content-Security-Policy: script-src 'strict-dynamic' 'nonce-dummy' diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker-importScripts.https.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker-importScripts.https.html new file mode 100644 index 0000000000..681e19547a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker-importScripts.https.html @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker.https.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker.https.html new file mode 100644 index 0000000000..213eb6276d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-strict_dynamic_worker.https.html @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/script-src-wildcards-disallowed.html b/testing/web-platform/tests/content-security-policy/script-src/script-src-wildcards-disallowed.html new file mode 100644 index 0000000000..7bf3d89b67 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/script-src-wildcards-disallowed.html @@ -0,0 +1,63 @@ + + + + + script-src disallowed wildcard use + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-allowed.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-allowed.sub.html new file mode 100644 index 0000000000..8b3b45f77b --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-allowed.sub.html @@ -0,0 +1,42 @@ + + + + + + + scripthash-allowed + + + + + + + + + + + +

+ This tests the effect of a valid script-hash value. It passes if no CSP violation is generated, and the alert_assert() is executed. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-base64url-converts-to-base64.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-base64url-converts-to-base64.sub.html new file mode 100644 index 0000000000..82bf3b8622 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-base64url-converts-to-base64.sub.html @@ -0,0 +1,40 @@ + + + + + + Test whether hash-src are normalized from base64url to base64. + + + + + + + + + + +

+ This tests whether hash-src are normalized from base64url + to base64. It passes if no CSP violation is generated, and + the alert_assert() calls are executed. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked-error-event.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked-error-event.html new file mode 100644 index 0000000000..62b869335f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked-error-event.html @@ -0,0 +1,10 @@ + + + CSP script-hash block causes error event + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked.sub.html new file mode 100644 index 0000000000..6bdc9f992d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-basic-blocked.sub.html @@ -0,0 +1,72 @@ + + + + + + + scripthash-basic-blocked + + + + + + + + + + + + + + +

+ This tests the effect of a valid script-hash value, with one valid script and several invalid ones. It passes if one alert is executed and a CSP violation is reported. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-case-insensitive.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-case-insensitive.sub.html new file mode 100644 index 0000000000..5b8f1bb823 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-case-insensitive.sub.html @@ -0,0 +1,60 @@ + + + + + + Test whether hash-algorithm parts are matched case-insensitively + + + + + + + + + + + + + + +

+ This tests whether hash-algorithm parts are matched + case-insensitively. It passes if no CSP violation is generated, and + the alert_assert() calls are executed. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-1.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-1.html new file mode 100644 index 0000000000..9da41dd1ef --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-1.html @@ -0,0 +1,35 @@ + + + CSP inline script check is done at #prepare-a-script (hash) + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-2.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-2.html new file mode 100644 index 0000000000..927d60a8d7 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-changed-2.html @@ -0,0 +1,35 @@ + + + CSP inline script check is done at #prepare-a-script (hash) + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-default-src.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-default-src.sub.html new file mode 100644 index 0000000000..2bccf85dcd --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-default-src.sub.html @@ -0,0 +1,21 @@ + + + + + script-hash allowed from default-src + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-ignore-unsafeinline.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-ignore-unsafeinline.sub.html new file mode 100644 index 0000000000..5d3dd8b38e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-ignore-unsafeinline.sub.html @@ -0,0 +1,56 @@ + + + + + + + + scripthash-ignore-unsafeinline + + + + + + + + + + +

+ This tests that a valid hash value disables inline JavaScript, even if 'unsafe-inline' is present. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scripthash-unicode-normalization.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scripthash-unicode-normalization.sub.html new file mode 100644 index 0000000000..b082b55e21 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scripthash-unicode-normalization.sub.html @@ -0,0 +1,72 @@ + + + + + + + scripthash-unicode-normalization + + + + + + + + + +

+ This tests Unicode normalization. While appearing the same, the strings in the scripts are different Unicode points, but through normalization, should be the same when the hash is taken. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-allowed.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-allowed.sub.html new file mode 100644 index 0000000000..2cd7d646dd --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-allowed.sub.html @@ -0,0 +1,68 @@ + + + + + + + scriptnonce-allowed + + + + + + + + + + +

+ This tests the effect of a valid script-nonce value. It passes if no CSP violation is generated and the alerts are executed. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-and-scripthash.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-and-scripthash.sub.html new file mode 100644 index 0000000000..232ca052e5 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-and-scripthash.sub.html @@ -0,0 +1,79 @@ + + + + + + + scriptnonce-and-scripthash + + + + + + + + + + + + + +

+ This tests the combined use of script hash and script nonce. It passes if a CSP violation is generated and the three alerts show PASS. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-basic-blocked.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-basic-blocked.sub.html new file mode 100644 index 0000000000..2001afcd9c --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-basic-blocked.sub.html @@ -0,0 +1,43 @@ + + + + + + + scriptnonce-basic-blocked + + + + + + + + + + + +

+ This tests the effect of a valid script-nonce value. It passes if a CSP violation is generated, and the two PASS alerts are executed. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-1.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-1.html new file mode 100644 index 0000000000..75f92f354a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-1.html @@ -0,0 +1,31 @@ + + + CSP inline script check is done at #prepare-a-script (nonce) + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-2.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-2.html new file mode 100644 index 0000000000..f2321dd656 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-changed-2.html @@ -0,0 +1,31 @@ + + + CSP inline script check is done at #prepare-a-script (nonce) + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-ignore-unsafeinline.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-ignore-unsafeinline.sub.html new file mode 100644 index 0000000000..6d752b3b7e --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-ignore-unsafeinline.sub.html @@ -0,0 +1,74 @@ + + + + + + + scriptnonce-ignore-unsafeinline + + + + + + + + + + + + +

+ This tests that a valid nonce disables inline JavaScript, even if 'unsafe-inline' is present. +

+
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-redirect.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-redirect.sub.html new file mode 100644 index 0000000000..e659e570ee --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-redirect.sub.html @@ -0,0 +1,62 @@ + + + + + + + scriptnonce-redirect + + + + + + + + + This tests whether a deferred script load caused by a redirect is properly allowed by a nonce. + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html new file mode 100644 index 0000000000..154ab68de6 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html @@ -0,0 +1,43 @@ + + + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html.sub.headers new file mode 100644 index 0000000000..d23494ca83 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/scriptnonce-specified-source.sub.html.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy: script-src {{host}}:{{ports[http][0]}} 'nonce-specified' \ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/script-src/simpleSourcedScript.js b/testing/web-platform/tests/content-security-policy/script-src/simpleSourcedScript.js new file mode 100644 index 0000000000..deca86508f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/simpleSourcedScript.js @@ -0,0 +1 @@ +window.postMessage(document.currentScript.id, "*"); diff --git a/testing/web-platform/tests/content-security-policy/script-src/srcdoc-doesnt-bypass-script-src.sub.html b/testing/web-platform/tests/content-security-policy/script-src/srcdoc-doesnt-bypass-script-src.sub.html new file mode 100644 index 0000000000..2cae85ec30 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/srcdoc-doesnt-bypass-script-src.sub.html @@ -0,0 +1,35 @@ + + + + + + + srcdoc-doesnt-bypass-script-src + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/change-scripthash-before-execute.js b/testing/web-platform/tests/content-security-policy/script-src/support/change-scripthash-before-execute.js new file mode 100644 index 0000000000..a04e8575b2 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/change-scripthash-before-execute.js @@ -0,0 +1,10 @@ +// This script is executed after |scr1| and |scr2| are inserted into DOM +// before their execution (if not blocked by CSP). +if (document.getElementById("scr1")) { + document.getElementById("scr1").innerText = + "log1 += 'scr1 at #execute-the-script-block';"; +} +if (document.getElementById("scr2")) { + document.getElementById("scr2").innerText = + "log2 += 'scr2 at #execute-the-script-block';"; +} diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/change-scriptnonce-before-execute.js b/testing/web-platform/tests/content-security-policy/script-src/support/change-scriptnonce-before-execute.js new file mode 100644 index 0000000000..2676b34728 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/change-scriptnonce-before-execute.js @@ -0,0 +1,8 @@ +// This script is executed after |scr1| and |scr2| are inserted into DOM +// before their execution (if not blocked by CSP). +if (document.getElementById('scr1')) { + document.getElementById('scr1').setAttribute('nonce', 'wrong'); +} +if (document.getElementById('scr2')) { + document.getElementById('scr2').setAttribute('nonce', 'abc'); +} diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/empty.css b/testing/web-platform/tests/content-security-policy/script-src/support/empty.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/inject-script.js b/testing/web-platform/tests/content-security-policy/script-src/support/inject-script.js new file mode 100644 index 0000000000..c04033c46f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/inject-script.js @@ -0,0 +1,5 @@ +document.write(""); + +var s = document.createElement('script'); +s.textContent = "log('Pass 2 of 2');"; +document.body.appendChild(s); diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/inline-script-should-be-blocked.js b/testing/web-platform/tests/content-security-policy/script-src/support/inline-script-should-be-blocked.js new file mode 100644 index 0000000000..f32d25074b --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/inline-script-should-be-blocked.js @@ -0,0 +1,14 @@ +var t; +async_test(t => { + self.t = t; + const s = document.createElement('script'); + s.onerror = t.step_func(function() { + assert_unreached('Script error event should not be fired.'); + }); + s.onload = t.step_func(function() { + assert_unreached('Script load event should not be fired.'); + }); + s.innerText = 'self.t.assert_unreached("Script should not run.");' + document.body.appendChild(s); + setTimeout(() => t.done(), 2000); +}); diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/post-message.js b/testing/web-platform/tests/content-security-policy/script-src/support/post-message.js new file mode 100644 index 0000000000..69daa31d2f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/post-message.js @@ -0,0 +1 @@ +postMessage("importScripts allowed"); diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js b/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js new file mode 100644 index 0000000000..9aa87129ae --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js @@ -0,0 +1,5 @@ +var id = 0; +try { + id = eval("1 + 2 + 3"); +} catch (e) {} +postMessage(id === 0 ? "eval blocked" : "eval allowed"); diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js.sub.headers new file mode 100644 index 0000000000..afdcc7c011 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-eval.js.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy: script-src 'unsafe-inline' diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js b/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js new file mode 100644 index 0000000000..03d9bf4cbb --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js @@ -0,0 +1,7 @@ +var fn = function() { + postMessage('Function() function blocked'); +} +try { + fn = new Function("", "postMessage('Function() function allowed');"); +} catch (e) {} +fn(); diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js.sub.headers new file mode 100644 index 0000000000..afdcc7c011 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-function-function.js.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy: script-src 'unsafe-inline' diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js new file mode 100644 index 0000000000..d2b6691b8a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js @@ -0,0 +1,17 @@ +var message = "importScripts allowed"; +try { + importScripts("/content-security-policy/support/post-message.js"); +} catch (e) { + message = "importScripts blocked"; +} + +if (typeof SharedWorkerGlobalScope === "function") { + onconnect = function (e) { + var port = e.ports[0]; + + port.onmessage = function () { port.postMessage(message); } + port.postMessage(message); + }; +} else if (typeof DedicatedWorkerGlobalScope === "function") { + self.postMessage(message); +} diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js.sub.headers new file mode 100644 index 0000000000..57616b1fc2 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-importscripts.js.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy: script-src 'none' diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js new file mode 100644 index 0000000000..c4241c97d0 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js @@ -0,0 +1,16 @@ +var id = 0; +try { + id = setTimeout("postMessage('handler invoked')", 100); +} catch (e) {} +var message = id === 0 ? "setTimeout blocked" : "setTimeout allowed"; + +if (typeof SharedWorkerGlobalScope === "function") { + onconnect = function (e) { + var port = e.ports[0]; + + port.onmessage = function () { port.postMessage(message); } + port.postMessage(message); + }; +} else if (typeof DedicatedWorkerGlobalScope === "function") { + self.postMessage(message); +} diff --git a/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js.sub.headers b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js.sub.headers new file mode 100644 index 0000000000..57616b1fc2 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/support/worker-with-script-src-none-set-timeout.js.sub.headers @@ -0,0 +1 @@ +Content-Security-Policy: script-src 'none' diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-data-set-timeout.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-data-set-timeout.sub.html new file mode 100644 index 0000000000..ac4b608b08 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-data-set-timeout.sub.html @@ -0,0 +1,28 @@ + + + + + + + + worker-data-set-timeout + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-eval-blocked.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-eval-blocked.sub.html new file mode 100644 index 0000000000..01c9eb196f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-eval-blocked.sub.html @@ -0,0 +1,38 @@ + + + + + + + worker-eval-blocked + + + + + + + +

This test loads a worker, delivered with its own policy. + The eval() call in the worker should be forbidden by that + policy. No report should be generated because the worker + policy does not set a report-uri (although this parent + resource does).

+ +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-function-function-blocked.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-function-function-blocked.sub.html new file mode 100644 index 0000000000..8c1df9f667 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-function-function-blocked.sub.html @@ -0,0 +1,37 @@ + + + + + + + worker-function-function-blocked + + + + + + + +

This test loads a worker, delivered with its own policy. + The Function constructor should be forbidden by that + policy. No report should be generated because the worker + policy does not set a report-uri (although this parent + resource does).

+ +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-importscripts.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-importscripts.sub.html new file mode 100644 index 0000000000..ae7157cfa9 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-importscripts.sub.html @@ -0,0 +1,26 @@ + + + + + + worker-importscripts + + + + + + + + + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-script-src.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-script-src.sub.html new file mode 100644 index 0000000000..da7771b9c4 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-script-src.sub.html @@ -0,0 +1,32 @@ + + + + + + + worker-script-src + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/content-security-policy/script-src/worker-set-timeout.sub.html b/testing/web-platform/tests/content-security-policy/script-src/worker-set-timeout.sub.html new file mode 100644 index 0000000000..7e73626c6f --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/script-src/worker-set-timeout.sub.html @@ -0,0 +1,26 @@ + + + + + + worker-set-timeout + + + + + + + + + + -- cgit v1.2.3