summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Marchesini <amarchesini@mozilla.com>2018-05-10 11:24:25 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-07 06:10:12 +0200
commitf35bf8b65d25f88c7e34263337b05619a78868f6 (patch)
tree4393c0770d7cd0bacce82e790569fef4a6501c3a
parente597487f31726085464a6188ad004fb10fad8305 (diff)
downloadUXP-f35bf8b65d25f88c7e34263337b05619a78868f6.tar
UXP-f35bf8b65d25f88c7e34263337b05619a78868f6.tar.gz
UXP-f35bf8b65d25f88c7e34263337b05619a78868f6.tar.lz
UXP-f35bf8b65d25f88c7e34263337b05619a78868f6.tar.xz
UXP-f35bf8b65d25f88c7e34263337b05619a78868f6.zip
Bug 1459206 - Use FileSystemSecurity in ContentParent::RecvGetFilesRequest. r=ehsan, a=jcristau
--HG-- extra : rebase_source : 542dca7fe46dd965ecde4c8387685beaf20ec3de
-rw-r--r--dom/filesystem/tests/test_webkitdirectory.html1
-rw-r--r--dom/ipc/ContentParent.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/dom/filesystem/tests/test_webkitdirectory.html b/dom/filesystem/tests/test_webkitdirectory.html
index 825f5e8fb..591619e45 100644
--- a/dom/filesystem/tests/test_webkitdirectory.html
+++ b/dom/filesystem/tests/test_webkitdirectory.html
@@ -152,6 +152,7 @@ function test_changeDataWhileWorking() {
function test_setup() {
SpecialPowers.pushPrefEnv({"set": [["dom.input.dirpicker", true],
+ ["dom.filesystem.pathcheck.disabled", true],
["dom.webkitBlink.dirPicker.enabled", true]]}, next);
}
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index 3488e26bd..fb97adc42 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4721,6 +4721,14 @@ ContentParent::RecvGetFilesRequest(const nsID& aUUID,
{
MOZ_ASSERT(!mGetFilesPendingRequests.GetWeak(aUUID));
+ if (!mozilla::Preferences::GetBool("dom.filesystem.pathcheck.disabled", false)) {
+ RefPtr<FileSystemSecurity> fss = FileSystemSecurity::Get();
+ if (NS_WARN_IF(!fss ||
+ !fss->ContentProcessHasAccessTo(ChildID(), aDirectoryPath))) {
+ return IPC_FAIL_NO_REASON(this);
+ }
+ }
+
ErrorResult rv;
RefPtr<GetFilesHelper> helper =
GetFilesHelperParent::Create(aUUID, aDirectoryPath, aRecursiveFlag, this,