This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SuboriginPolicy header and unsafe-postmessage-send directive
This adds a SuboriginPolicy header that takes policies to bypass certain Suborigin restrictions. It also adds a specific unsafe-postmessage-send directive that specifies that the receiving end of a postMessage message event should seed the origin as the physical origin, rather than the serialized suborigin. BUG=336894 Review URL: https://codereview.chromium.org/1772873003 Cr-Commit-Position: refs/heads/master@{#381905}
- Loading branch information
1 parent
92a2678
commit 0233ac7
Showing
31 changed files
with
486 additions
and
230 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
...y/WebKit/LayoutTests/http/tests/security/suborigins/resources/post-document-to-parent.php
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
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
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 |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
"foo'bar", | ||
"foob@r", | ||
"foo bar", | ||
"Foobar", | ||
"FOOBAR", | ||
]; | ||
|
||
var iframe; | ||
|
36 changes: 36 additions & 0 deletions
36
.../WebKit/LayoutTests/http/tests/security/suborigins/suborigin-unsafe-postmessage-send.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,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Validate that unsafe-postmessage-send allows Suborigin to send messages as physical origin via postMessage.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<script> | ||
var iframe_test = async_test("Validate serialization of event.origin and event.suborigin in postMessage from an iframe"); | ||
var window_test = async_test("Validate serialization of event.origin and event.suborigin in postMessage from a window"); | ||
|
||
window.onmessage = function(event) { | ||
if (event.data.type === 'iframe') { | ||
iframe_test.step(function() { | ||
assert_equals(event.origin, "http://127.0.0.1:8000"); | ||
assert_equals(event.suborigin, "foobar1"); | ||
assert_equals(event.data.suborigin, "foobar1"); | ||
iframe_test.done(); | ||
}); | ||
} else if (event.data.type === 'window') { | ||
window_test.step(function() { | ||
assert_equals(event.origin, "http://127.0.0.1:8000"); | ||
assert_equals(event.suborigin, "foobar2"); | ||
assert_equals(event.data.suborigin, "foobar2");; | ||
window_test.done(); | ||
}); | ||
} else { | ||
assert_unreached(); | ||
} | ||
|
||
} | ||
|
||
window.open("resources/post-document-to-parent.php?suborigin=foobar2&type=window&suboriginpolicy='unsafe-postmessage-send';"); | ||
</script> | ||
<iframe src="resources/post-document-to-parent.php?suborigin=foobar1&type=iframe&suboriginpolicy='unsafe-postmessage-send';"></iframe> | ||
</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
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 |
---|---|---|
|
@@ -18,8 +18,6 @@ | |
var test_suborigin_names = [ | ||
"foobar", | ||
"foob4r", | ||
"Foobar", | ||
"FOOBAR", | ||
"42", | ||
"foo-bar", | ||
"-foobar", | ||
|
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.