Commit 3d6a3373 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Disallow sharing PlayFiles root

Sharing Play files root also shares Downloads which may
be unexpected.

UI Test in crosreview.com/1619443 since it is unlikely to merge
so well.

Bug: 958840
Change-Id: I0b199dc65698aa391c52021a1106a4d7631802ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1616703
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661252}
parent bbbbfe1f
...@@ -243,6 +243,13 @@ CrostiniImpl.prototype.canSharePath = function(vmName, entry, persist) { ...@@ -243,6 +243,13 @@ CrostiniImpl.prototype.canSharePath = function(vmName, entry, persist) {
return false; return false;
} }
// TODO(crbug.com/958840): Sharing Play files root is disallowed until
// we can ensure it will not also share Downloads.
if (root === VolumeManagerCommon.RootType.ANDROID_FILES &&
entry.fullPath === '/') {
return false;
}
// Special case to disallow PluginVm sharing on /MyFiles/PluginVm and // Special case to disallow PluginVm sharing on /MyFiles/PluginVm and
// subfolders since it gets shared by default. // subfolders since it gets shared by default.
if (vmName === CrostiniImpl.PLUGIN_VM && if (vmName === CrostiniImpl.PLUGIN_VM &&
......
...@@ -171,14 +171,22 @@ function testCanSharePath() { ...@@ -171,14 +171,22 @@ function testCanSharePath() {
setDriveFsEnabled(true); setDriveFsEnabled(true);
// TODO(crbug.com/917920): Add computers_grand_root and computers when DriveFS // TODO(crbug.com/917920): Add computers_grand_root and computers when DriveFS
// enforces allowed write paths. // enforces allowed write paths.
const allowed = [ const allowed = [
'downloads', 'removable', 'android_files', 'drive', 'downloads', 'removable', 'android_files', 'drive',
'shared_drives_grand_root', 'team_drive' 'shared_drives_grand_root', 'team_drive'
]; ];
for (const type of allowed) { for (const type of allowed) {
volumeManagerRootType = type; volumeManagerRootType = type;
assertTrue(crostini.canSharePath('vm', root, true)); // TODO(crbug.com/958840): Sharing Play files root is disallowed until
assertTrue(crostini.canSharePath('vm', root, false)); // we can ensure it will not also share Downloads.
if (type === 'android_files') {
assertFalse(crostini.canSharePath('vm', root, true));
assertFalse(crostini.canSharePath('vm', root, false));
} else {
assertTrue(crostini.canSharePath('vm', root, true));
assertTrue(crostini.canSharePath('vm', root, false));
}
assertFalse(crostini.canSharePath('vm', rootFile, true)); assertFalse(crostini.canSharePath('vm', rootFile, true));
assertTrue(crostini.canSharePath('vm', rootFile, false)); assertTrue(crostini.canSharePath('vm', rootFile, false));
assertTrue(crostini.canSharePath('vm', rootFolder, true)); assertTrue(crostini.canSharePath('vm', rootFolder, true));
......
...@@ -211,17 +211,9 @@ shareBase.testSharePaths = async (vmName, vmNameSelector, enumUma, done) => { ...@@ -211,17 +211,9 @@ shareBase.testSharePaths = async (vmName, vmNameSelector, enumUma, done) => {
givePermission + 'files in your Google Drive. ' + givePermission + 'files in your Google Drive. ' +
'Changes will sync to your other devices.'); 'Changes will sync to your other devices.');
// Verify share with dialog for Play files.
test.mountAndroidFiles();
await test.waitForElement(androidRoot);
await shareBase.verifyShareWithDialog(
'Android files', androidRoot, menuShareWithDirTree, shareWithDirTree,
givePermission + 'files in the Play files folder');
// Reset Linux files and Play files back to unmounted. // Reset Linux files and Play files back to unmounted.
chrome.fileManagerPrivate.removeMount('crostini'); chrome.fileManagerPrivate.removeMount('crostini');
await test.waitForElement(fakeLinuxFiles); await test.waitForElement(fakeLinuxFiles);
chrome.fileManagerPrivate.removeMount('android_files');
// Restore fmp.*. // Restore fmp.*.
chrome.fileManagerPrivate.sharePathsWithCrostini = oldSharePaths; chrome.fileManagerPrivate.sharePathsWithCrostini = oldSharePaths;
......
...@@ -810,7 +810,6 @@ ...@@ -810,7 +810,6 @@
*/ */
testcase.dirContextMenuPlayFiles = async () => { testcase.dirContextMenuPlayFiles = async () => {
const playFilesMenus = [ const playFilesMenus = [
['#share-with-linux', true],
['#new-folder', false], ['#new-folder', false],
]; ];
const folderMenus = [ const folderMenus = [
......
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