-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 272448.2@safari-7618-branch (18fd76f). https://bugs.webki…
…t.org/show_bug.cgi?id=266703 Ensure Filesystem root path is not empty https://bugs.webkit.org/show_bug.cgi?id=266703 rdar://119813501 Reviewed by Chris Dumez. When the root path is empty, then the file's name can define an arbitrary filesystem path. This change ensures that the path is non-empty, therefore the virtual filesystem must be defined under a directory that the user selected. * LayoutTests/http/tests/security/file-system-access-via-dataTransfer-expected.txt: Added. * LayoutTests/http/tests/security/file-system-access-via-dataTransfer.html: Added. * Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getEntry): (WebCore::DOMFileSystem::getFile): Canonical link: https://commits.webkit.org/272448.2@safari-7618-branch Canonical link: https://commits.webkit.org/274313.49@webkitglib/2.44
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
LayoutTests/http/tests/security/file-system-access-via-dataTransfer-expected.txt
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,10 @@ | ||
Test that accessing local file system metadata is not allowed | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS Should not receive file | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
50 changes: 50 additions & 0 deletions
50
LayoutTests/http/tests/security/file-system-access-via-dataTransfer.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,50 @@ | ||
<html> | ||
<head> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
<body> | ||
|
||
<script> | ||
description("Test that accessing local file system metadata is not allowed"); | ||
|
||
function runTest() { | ||
if (!window.internals) { | ||
alert("This test depends on Internals"); | ||
return; | ||
} | ||
|
||
window.jsTestIsAsync = true; | ||
|
||
let path = location.pathname.split("/"); | ||
let targetFileName = internals.createTemporaryFile(`${path[path.length - 1]}`, ""); | ||
|
||
let input = document.createElement("input"); | ||
input.type = "file"; | ||
|
||
let file = new File([], targetFileName, {"type":"text/plain"}); | ||
|
||
dataTransfer = new DataTransfer(); | ||
dataTransfer.items.add(file) | ||
input.files = dataTransfer.files; | ||
|
||
var functionOnSuccess = function (file) | ||
{ | ||
testFailed("Should not receive file"); | ||
finishJSTest() | ||
} | ||
|
||
var functionOnError = function (value) | ||
{ | ||
testPassed("Should not receive file"); | ||
finishJSTest() | ||
} | ||
|
||
input.webkitEntries.forEach((entry) => { | ||
entry.file(functionOnSuccess, functionOnError) | ||
}); | ||
} | ||
|
||
runTest(); | ||
|
||
</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