Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit CSP tests #118

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions csp/CSP_default-src-inline-allowed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
header("Content-Security-Policy: default-src 'self' about: 'unsafe-inline'");
header("X-Content-Security-Policy: default-src 'self' about: 'unsafe-inline'");
header("X-WebKit-CSP: default-src 'self' about: 'unsafe-inline'");
?>
<!DOCTYPE html>
<html>
<head>
<title>CSP Test: default-src 'self' about: 'unsafe-inline'</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta descriptionn="Content-Security-Policy Test: default-src 'self' about: 'unsafe-inline'" />
<link rel="author" title="abarth" />
<script src="http://www.w3c-test.org/resources/testharness.js"></script>
<script src="http://www.w3c-test.org/resources/testharnessreport.js"></script>
</head>
<div id="log"></div>
<script>
test(function() {assert_true(true)}, 'Inline scripts run (1 of 3)');
</script>
<iframe style="display:none" src="javascript:parent.test(function() {parent.assert_true(true)}, 'JavaScript URLs run (2 of 3)');"></iframe>
<img style="display:none"
onerror="test(function() {assert_true(true)}, 'Inline event handlers run (3 of 3)')"
src="about:blank">
</body>
</html>
26 changes: 26 additions & 0 deletions csp/CSP_default-src-inline-blocked.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
header("Content-Security-Policy: default-src 'self'");
header("X-Content-Security-Policy: default-src 'self'");
header("X-WebKit-CSP: default-src 'self'");
?>
<!DOCTYPE html>
<html>
<head>
<title>CSP Test: default-src 'self' about: 'unsafe-inline'</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta descriptionn="Content-Security-Policy Test: default-src 'self' about: 'unsafe-inline'" />
<link rel="author" title="abarth" />
<script src="http://www.w3c-test.org/resources/testharness.js"></script>
<script src="http://www.w3c-test.org/resources/testharnessreport.js"></script>
</head>
<div id="log"></div>
<script src="resources/pass.js"></script>
<script>
test(function() {assert_true(false)}, 'Inline scripts run (1 of 3)');
</script>
<iframe style="display:none" src="javascript:parent.test(function() {parent.assert_true(false)}, 'JavaScript URLs run (2 of 3)');"></iframe>
<img style="display:none"
onerror="test(function() {assert_true(false)}, 'Inline event handlers run (3 of 3)')"
src="about:blank">
</body>
</html>