Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1818)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc

Issue 14864004: Fix security errors when accessing files and volumes in Files.app V2 due to using unregistered hand… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc
index 36cb08ab1513c0d48c6c1a83f9177a03e40e04a2..b4d4121fb14d3fb7914c458c8cc79d6904ea8d21 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc
@@ -817,13 +817,18 @@ bool ExtensionTaskExecutor::ExecuteAndNotify(
if (!FileBrowserHasAccessPermissionForFiles(file_urls))
return false;
- scoped_refptr<const Extension> handler = GetExtension();
- if (!handler.get())
+ // Find the target extension.
+ scoped_refptr<const Extension> extension = GetExtension();
+ if (!extension.get())
return false;
- int handler_pid = ExtractProcessFromExtensionId(profile(), handler->id());
- if (handler_pid <= 0) {
- if (!extensions::BackgroundInfo::HasLazyBackgroundPage(handler))
+ // Forbid calling undeclared handlers.
+ if (!FindFileBrowserHandler(extension, action_id_))
+ return false;
+
+ int extension_pid = ExtractProcessFromExtensionId(profile(), extension->id());
+ if (extension_pid <= 0) {
+ if (!extensions::BackgroundInfo::HasLazyBackgroundPage(extension))
return false;
}
@@ -833,7 +838,7 @@ bool ExtensionTaskExecutor::ExecuteAndNotify(
// send. The file access permissions will be granted to the extension in the
// file system context for the files in |file_urls|.
GURL site = extensions::ExtensionSystem::Get(profile())->extension_service()->
- GetSiteForExtensionId(handler->id());
+ GetSiteForExtensionId(extension->id());
scoped_refptr<fileapi::FileSystemContext> file_system_context_handler =
BrowserContext::GetStoragePartitionForSite(profile(), site)->
GetFileSystemContext();
@@ -844,9 +849,9 @@ bool ExtensionTaskExecutor::ExecuteAndNotify(
&ExtensionTaskExecutor::RequestFileEntryOnFileThread,
this,
file_system_context_handler,
- Extension::GetBaseURLFromExtensionId(handler->id()),
- handler,
- handler_pid,
+ Extension::GetBaseURLFromExtensionId(extension->id()),
+ extension,
+ extension_pid,
file_urls));
return true;
}
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698