-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Origin isolation: implement window.originIsolationRestricted
See WICG/origin-agent-cluster#24 and WICG/origin-agent-cluster#30 for background, and whatwg/html#5545 for the specification. Failing test expectations include: - We implement (3) from WICG/origin-agent-cluster#24 instead of (2) for now, so we fail getter-sandboxed-iframe. Tracking at https://crbug.com/1095653. - data: URLs are not [SecureContext] in Chromium (https://crbug.com/1095656) so getter-data-url fails. - Other failures are due to the lack of origin vs site-keying, which is now more directly observable. See bug 1067389. Bug: 1042415, 1067389 Change-Id: I20c2d3e3fec7a5c0f1d12c386999c32fe27b6a34
- Loading branch information
1 parent
6152228
commit 50c5dee
Showing
29 changed files
with
260 additions
and
13 deletions.
There are no files selected for viewing
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,38 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.originIsolationRestricted for a data: URL</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { | ||
waitForIframe, | ||
testOriginIsolationRestricted | ||
} from "./resources/helpers.mjs"; | ||
|
||
promise_setup(() => { | ||
const iframe = document.createElement("iframe"); | ||
|
||
// This copies parts of resources/send-origin-isolation-header.py that allow | ||
// us to reuse testOriginIsolationRestricted. | ||
iframe.src = `data:text/html,<script> | ||
window.onmessage = () => { | ||
parent.postMessage(self.originIsolationRestricted, "*"); | ||
}; | ||
</` + `script> | ||
`; | ||
|
||
const waitPromise = waitForIframe(iframe); | ||
document.body.append(iframe); | ||
return waitPromise; | ||
}); | ||
|
||
// The data: URL iframe has an opaque origin, so it definitely should return | ||
// false. It's pretty unlikely that it would return true anyway, since we can't | ||
// set the header on the iframe, but we should test it to make sure there isn't | ||
// some strange main page -> data: URL iframe inheritance going on. | ||
|
||
testOriginIsolationRestricted(0, false); | ||
</script> |
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 @@ | ||
Origin-Isolation: ?1 |
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,27 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.crossOriginIsolated for a removed frame</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { navigateIframe } from "./resources/helpers.mjs"; | ||
|
||
promise_test(async () => { | ||
// We cannot use insertIframe because it sets both `document.domain`s. That | ||
// shouldn't matter, but Chrome has a bug (https://crbug.com/1095145), so | ||
// let's avoid making the test needlessly fail because of that bug. | ||
const iframe = document.createElement("iframe"); | ||
const navigatePromise = navigateIframe(iframe, "{{hosts[][]}}", "?1"); | ||
document.body.append(iframe); | ||
await navigatePromise; | ||
|
||
const frameWindow = iframe.contentWindow; | ||
|
||
assert_equals(frameWindow.originIsolationRestricted, true, "before"); | ||
iframe.remove(); | ||
assert_equals(frameWindow.originIsolationRestricted, true, "after"); | ||
}, "Removing the iframe does not change originIsolationRestricted"); | ||
</script> |
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 @@ | ||
Origin-Isolation: ?1 |
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,30 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>window.originIsolationRestricted for a sandboxed frame</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<script type="module"> | ||
import { | ||
navigateIframe, | ||
testOriginIsolationRestricted | ||
} from "./resources/helpers.mjs"; | ||
|
||
// We do this manually instead of using insertIframe because we want to add a | ||
// sandbox="" attribute and we don't want to set both document.domains. | ||
promise_setup(() => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.sandbox = "allow-scripts"; | ||
const navigatePromise = navigateIframe(iframe, "{{hosts[][]}}", "?1"); | ||
document.body.append(iframe); | ||
return navigatePromise; | ||
}); | ||
|
||
// Because sandboxed iframes have an opaque origin, their agent cluster key is | ||
// always an origin, so there are no additional restrictions imposed by origin | ||
// isolation. Thus the getter returns false. | ||
|
||
testOriginIsolationRestricted(0, false); | ||
</script> |
1 change: 1 addition & 0 deletions
1
origin-isolation/getter-sandboxed-iframe.sub.https.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 @@ | ||
Origin-Isolation: ?1 |
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 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 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
Oops, something went wrong.