forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR: w3c/webappsec-csp#290 Bug: 805886 Change-Id: I5bdda65c7e70e729b33a3647135fee6453e97e66 Reviewed-on: https://chromium-review.googlesource.com/934181 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Mike West <[email protected]> Cr-Commit-Position: refs/heads/master@{#541769}
- Loading branch information
1 parent
38aab7a
commit c36f238
Showing
52 changed files
with
745 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
content-security-policy/navigate-to/anchor-navigation-always-allowed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<a name="anchor"></a> | ||
|
||
<script> | ||
var t = async_test("Test that anchor navigation is allowed regardless of the `navigate-to` directive"); | ||
|
||
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have triggered any violation")); | ||
|
||
try { | ||
window.location.hash = "anchor"; | ||
t.done(); | ||
} catch(ex) {} | ||
</script> | ||
|
||
</body> |
4 changes: 4 additions & 0 deletions
4
content-security-policy/navigate-to/anchor-navigation-always-allowed.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Expires: Mon, 26 Jul 1997 05:00:00 GMT | ||
Cache-Control: no-store, no-cache, must-revalidate | ||
Pragma: no-cache | ||
Content-Security-Policy: navigate-to 'none' |
18 changes: 18 additions & 0 deletions
18
content-security-policy/navigate-to/child-navigates-parent-allowed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child can navigate the parent because the relevant policy belongs to the navigation initiator (in this case the child)"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
|
||
<iframe srcdoc="<iframe src='support/navigate_parent.sub.html?csp=navigate-to%20%27self%27'>"> | ||
|
||
</body> |
4 changes: 4 additions & 0 deletions
4
content-security-policy/navigate-to/child-navigates-parent-allowed.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Expires: Mon, 26 Jul 1997 05:00:00 GMT | ||
Cache-Control: no-store, no-cache, must-revalidate | ||
Pragma: no-cache | ||
Content-Security-Policy: navigate-to support/navigate_parent.sub.html |
19 changes: 19 additions & 0 deletions
19
content-security-policy/navigate-to/child-navigates-parent-blocked.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child can't navigate the parent because the relevant policy belongs to the navigation initiator (in this case the child)"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
</script> | ||
|
||
<iframe srcdoc="<iframe src='support/navigate_parent.sub.html?csp=navigate-to%20%27none%27'>"> | ||
|
||
</body> |
4 changes: 4 additions & 0 deletions
4
content-security-policy/navigate-to/child-navigates-parent-blocked.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Expires: Mon, 26 Jul 1997 05:00:00 GMT | ||
Cache-Control: no-store, no-cache, must-revalidate | ||
Pragma: no-cache | ||
Content-Security-Policy: navigate-to 'self' |
16 changes: 16 additions & 0 deletions
16
content-security-policy/navigate-to/form-action/form-action-allows-navigate-to-allows.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that form-action overrides navigate-to when present."); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html"> | ||
</body> |
16 changes: 16 additions & 0 deletions
16
content-security-policy/navigate-to/form-action/form-action-allows-navigate-to-blocks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that form-action overrides navigate-to when present."); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html"> | ||
</body> |
17 changes: 17 additions & 0 deletions
17
content-security-policy/navigate-to/form-action/form-action-blocks-navigate-to-allows.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that form-action overrides navigate-to when present."); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'form-action'); | ||
}); | ||
</script> | ||
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html"> | ||
</body> |
17 changes: 17 additions & 0 deletions
17
content-security-policy/navigate-to/form-action/form-action-blocks-navigate-to-blocks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that form-action overrides navigate-to when present."); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'form-action'); | ||
}); | ||
</script> | ||
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html"> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27&action=post_message_to_frame_owner.html"> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27&action=post_message_to_frame_owner.html"> | ||
</body> |
16 changes: 16 additions & 0 deletions
16
content-security-policy/navigate-to/form-cross-origin-allowed.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}&action=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html"> | ||
</body> |
17 changes: 17 additions & 0 deletions
17
content-security-policy/navigate-to/form-cross-origin-blocked.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27&action=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html"> | ||
</body> |
16 changes: 16 additions & 0 deletions
16
content-security-policy/navigate-to/form-redirected-allowed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27&action=redirect_to_post_message_to_frame_owner.py"> | ||
</body> |
17 changes: 17 additions & 0 deletions
17
content-security-policy/navigate-to/form-redirected-blocked.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
</script> | ||
<iframe src="support/form_action_navigation.sub.html?csp=navigate-to%20{{location[server]}}/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py&action=redirect_to_post_message_to_frame_owner.py"> | ||
</body> |
18 changes: 18 additions & 0 deletions
18
content-security-policy/navigate-to/href-location-allowed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20%27self%27&target=post_message_to_frame_owner.html", "_blank"); | ||
</script> | ||
|
||
</body> |
19 changes: 19 additions & 0 deletions
19
content-security-policy/navigate-to/href-location-blocked.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20%27none%27&target=post_message_to_frame_owner.html", "_blank"); | ||
</script> | ||
|
||
</body> |
18 changes: 18 additions & 0 deletions
18
content-security-policy/navigate-to/href-location-cross-origin-allowed.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}&target=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html", "_blank"); | ||
</script> | ||
|
||
</body> |
19 changes: 19 additions & 0 deletions
19
content-security-policy/navigate-to/href-location-cross-origin-blocked.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20%27self%27&target=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html", "_blank"); | ||
</script> | ||
|
||
</body> |
18 changes: 18 additions & 0 deletions
18
content-security-policy/navigate-to/href-location-redirected-allowed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is allowed"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'success'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20%27self%27&target=redirect_to_post_message_to_frame_owner.py", "_blank"); | ||
</script> | ||
|
||
</body> |
19 changes: 19 additions & 0 deletions
19
content-security-policy/navigate-to/href-location-redirected-blocked.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
var t = async_test("Test that the child iframe navigation is blocked"); | ||
window.onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data.result, 'fail'); | ||
assert_equals(e.data.violatedDirective, 'navigate-to'); | ||
}); | ||
|
||
window.open("support/href_location_navigation.sub.html?csp=navigate-to%20{{location[server]}}/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py&target=redirect_to_post_message_to_frame_owner.py", "_blank"); | ||
</script> | ||
|
||
</body> |
Oops, something went wrong.