Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /content-security-policy/embedded-enforcement/subsumption_algorithm-strict_dynamic.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>Embedded Enforcement: Subsumption Algorithm - 'strict-dynamic' keyword.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/testharness-helper.sub.js"></script>
</head>
<body>
<script>
var tests = [
// Note that the returned csp should always allow execution of an
// inline script with nonce "abc" (as returned by
// support/echo-policy-multiple.py), otherwise the test might
// return false negatives.
{ "name": "'strict-dynamic' is ineffective for `style-src`.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' is ineffective for `img-src`.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' is ineffective for `frame-src`.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' is ineffective for `child-src`.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' is effective only for `script-src`.",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "'strict-dynamic' is properly handled for finding effective policy.",
"returned_csp_2": "script-src 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "'strict-dynamic' makes host source expressions ineffective.",
"required_csp": "script-src 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' makes scheme source expressions ineffective.",
"required_csp": "script-src 'strict-dynamic' 'nonce-abc'",
"returned_csp_1": "script-src http: 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' makes 'self' ineffective.",
"required_csp": "script-src 'strict-dynamic' 'nonce-abc'",
"returned_csp_1": "script-src 'self' 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' makes 'unsafe-inline' ineffective.",
"required_csp": "script-src 'strict-dynamic' 'nonce-abc'",
"returned_csp_1": "script-src 'unsafe-inline' 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "'strict-dynamic' has to be allowed by required csp if it is present in returned csp.",
"required_csp": "script-src 'nonce-abc'",
"returned_csp_1": "script-src 'strict-dynamic' 'nonce-abc'",
"expected": IframeLoad.EXPECT_BLOCK },
];
tests.forEach(test => {
async_test(t => {
var url = generateUrlWithPolicies(Host.CROSS_ORIGIN, test.returned_csp_1);
if (test.returned_csp_2)
url.searchParams.append("policy2", test.returned_csp_2);
assert_iframe_with_csp(t, url, test.required_csp, test.expected, test.name, null);
}, test.name);
});
</script>
</body>
</html>