Commit 857feaa4 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Fix permission for MyFiles/* directory in ChromeOS.

Users are now allowed to manage folders and files inside MyFiles in
ChromeOS, this CL whitelist MyFiles in the same way it already does for
Downloads.

Bug: 913727, 873539
Change-Id: I828893021c26a99c12fab7509b603e2cf8603510
Reviewed-on: https://chromium-review.googlesource.com/c/1370161Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615642}
parent a3b8e8be
...@@ -106,6 +106,7 @@ bool IsAccessAllowedInternal(const base::FilePath& path, ...@@ -106,6 +106,7 @@ bool IsAccessAllowedInternal(const base::FilePath& path,
// directories below. // directories below.
static const base::FilePath::CharType* const kLocalAccessWhiteList[] = { static const base::FilePath::CharType* const kLocalAccessWhiteList[] = {
"/home/chronos/user/Downloads", "/home/chronos/user/Downloads",
"/home/chronos/user/MyFiles",
"/home/chronos/user/log", "/home/chronos/user/log",
"/home/chronos/user/WebRTC Logs", "/home/chronos/user/WebRTC Logs",
"/media", "/media",
...@@ -127,6 +128,7 @@ bool IsAccessAllowedInternal(const base::FilePath& path, ...@@ -127,6 +128,7 @@ bool IsAccessAllowedInternal(const base::FilePath& path,
if (!profile_path.empty()) { if (!profile_path.empty()) {
const base::FilePath downloads = profile_path.AppendASCII("Downloads"); const base::FilePath downloads = profile_path.AppendASCII("Downloads");
whitelist.push_back(downloads); whitelist.push_back(downloads);
whitelist.push_back(profile_path.AppendASCII("MyFiles"));
const base::FilePath webrtc_logs = profile_path.AppendASCII("WebRTC Logs"); const base::FilePath webrtc_logs = profile_path.AppendASCII("WebRTC Logs");
whitelist.push_back(webrtc_logs); whitelist.push_back(webrtc_logs);
} }
......
...@@ -207,6 +207,8 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) { ...@@ -207,6 +207,8 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) {
ASSERT_TRUE(base::PathService::Get(base::DIR_TEMP, &temp_dir)); ASSERT_TRUE(base::PathService::Get(base::DIR_TEMP, &temp_dir));
// Chrome OS allows the following directories. // Chrome OS allows the following directories.
EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/Downloads", "")); EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/Downloads", ""));
EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/MyFiles", ""));
EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/MyFiles/file.pdf", ""));
EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/log", "")); EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/log", ""));
EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/WebRTC Logs", "")); EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/WebRTC Logs", ""));
EXPECT_TRUE(IsAccessAllowed("/media", "")); EXPECT_TRUE(IsAccessAllowed("/media", ""));
...@@ -223,6 +225,8 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) { ...@@ -223,6 +225,8 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) {
// If profile path is given, the following additional paths are allowed. // If profile path is given, the following additional paths are allowed.
EXPECT_TRUE(IsAccessAllowed("/profile/Downloads", "/profile")); EXPECT_TRUE(IsAccessAllowed("/profile/Downloads", "/profile"));
EXPECT_TRUE(IsAccessAllowed("/profile/MyFiles", "/profile"));
EXPECT_TRUE(IsAccessAllowed("/profile/MyFiles/file.pdf", "/profile"));
EXPECT_TRUE(IsAccessAllowed("/profile/WebRTC Logs", "/profile")); EXPECT_TRUE(IsAccessAllowed("/profile/WebRTC Logs", "/profile"));
// GCache/v2/<opaque ID>/Logs is allowed. // GCache/v2/<opaque ID>/Logs is allowed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment