Commit 1c16a4ad authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Whitelist GCache/v2/*/Logs directories.

DriveFS logs are accessible via chrome://drive-internals. However, it
only shows the current log file. Allow access to all DriveFS logs by
whitelisting access to the DriveFS logs directories.

Bug: 890197
Change-Id: Icbcc46a1c4c697b07a5cbaac449b5c8a4d549e28
Reviewed-on: https://chromium-review.googlesource.com/c/1263681Reviewed-by: default avatarSergei Datsenko <dats@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597406}
parent 1d9b45f5
...@@ -146,6 +146,20 @@ bool IsAccessAllowedInternal(const base::FilePath& path, ...@@ -146,6 +146,20 @@ bool IsAccessAllowedInternal(const base::FilePath& path,
} }
} }
#if defined(OS_CHROMEOS)
// Allow access to DriveFS logs. These reside in
// $PROFILE_PATH/GCache/v2/<opaque id>/Logs.
base::FilePath path_within_gcache_v2;
if (profile_path.Append("GCache/v2")
.AppendRelativePath(path, &path_within_gcache_v2)) {
std::vector<std::string> components;
path_within_gcache_v2.GetComponents(&components);
if (components.size() > 1 && components[1] == "Logs") {
return true;
}
}
#endif // defined(OS_CHROMEOS)
DVLOG(1) << "File access denied - " << path.value().c_str(); DVLOG(1) << "File access denied - " << path.value().c_str();
return false; return false;
#endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
......
...@@ -239,6 +239,18 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) { ...@@ -239,6 +239,18 @@ TEST(ChromeNetworkDelegateStaticTest, IsAccessAllowed) {
EXPECT_TRUE(IsAccessAllowed("/profile/Downloads", "/profile")); EXPECT_TRUE(IsAccessAllowed("/profile/Downloads", "/profile"));
EXPECT_TRUE(IsAccessAllowed("/profile/WebRTC Logs", "/profile")); EXPECT_TRUE(IsAccessAllowed("/profile/WebRTC Logs", "/profile"));
// GCache/v2/<opaque ID>/Logs is allowed.
EXPECT_TRUE(IsAccessAllowed("/profile/GCache/v2/id/Logs", "/profile"));
EXPECT_TRUE(
IsAccessAllowed("/profile/GCache/v2/id/Logs/drivefs.txt", "/profile"));
EXPECT_FALSE(
IsAccessAllowed("/profile/GCache/v2/id/logs/drivefs.txt", "/profile"));
EXPECT_FALSE(
IsAccessAllowed("/profile/GCache/v2/id/something_else", "/profile"));
EXPECT_FALSE(IsAccessAllowed("/profile/GCache/v2/id", "/profile"));
EXPECT_FALSE(IsAccessAllowed("/profile/GCache/v2", "/profile"));
EXPECT_FALSE(IsAccessAllowed("/home/chronos/user/GCache/v2/id/Logs", ""));
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
// Android allows the following directories. // Android allows the following directories.
EXPECT_TRUE(IsAccessAllowed("/sdcard", "")); EXPECT_TRUE(IsAccessAllowed("/sdcard", ""));
......
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