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.
Disable local storage from Suborigins
Per the draft suborigin spec (https://w3c.github.io/webappsec-suborigins/), stateful storage mechanisms, including localStorage and sessionStorage, should not be accessible from a Suborigin. This CL disables DOM access to localStorage and sessionStorage on the window object. BUG=336894 [email protected] Review URL: https://codereview.chromium.org/1844713002 Cr-Commit-Position: refs/heads/master@{#384663}
- Loading branch information
1 parent
1e11d95
commit 7c22fc0
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
..._party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
header("Suborigin: foobar"); | ||
?> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Verifies that localStorage and sessionStorage are not accessible from within a suborigin</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
var expectedError = new DOMException("TEST EXCEPTION", "SecurityError"); | ||
var localStorageTest = async_test("localStorage must not be accessible from a suborigin"); | ||
var sessionStorageTest = async_test("sessionStorage must not be accessible from a suborigin"); | ||
|
||
function mustThrowSecurityException() { | ||
assert_throws(expectedError, function() { | ||
window.localStorage; | ||
}); | ||
this.done(); | ||
} | ||
|
||
localStorageTest.step(mustThrowSecurityException); | ||
sessionStorageTest.step(mustThrowSecurityException); | ||
</script> | ||
</body> | ||
</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