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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 11308360: Merge 170159 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1312/src/
Patch Set: Created 8 years 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 | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/fileapi_message_filter.cc
===================================================================
--- content/browser/fileapi/fileapi_message_filter.cc (revision 171066)
+++ content/browser/fileapi/fileapi_message_filter.cc (working copy)
@@ -524,6 +524,13 @@
if (!url.is_valid())
return;
+ // Make sure if this file is ok to be read (in the current architecture
+ // which means roughly same as the renderer is allowed to get the platform
+ // path to the file).
+ base::PlatformFileError error;
+ if (!HasPermissionsForFile(url, kReadFilePermissions, &error))
+ return;
+
// This is called only by pepper plugin as of writing to get the
// underlying platform path to upload a file in the sandboxed filesystem
// (e.g. TEMPORARY or PERSISTENT).
@@ -533,8 +540,19 @@
context_->CreateFileSystemOperation(
url, NULL)->AsLocalFileSystemOperation();
DCHECK(operation);
- if (operation)
- operation->SyncGetPlatformPath(url, platform_path);
+ if (!operation)
+ return;
+
+ operation->SyncGetPlatformPath(url, platform_path);
+
+ // The path is to be attached to URLLoader so we grant read permission
+ // for the file. (We first need to check if it can already be read not to
+ // overwrite existing permissions)
+ if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
+ process_id_, *platform_path)) {
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
+ process_id_, *platform_path);
+ }
}
void FileAPIMessageFilter::OnCreateSnapshotFile(
@@ -819,6 +837,14 @@
return success;
}
+ if (fileapi::SandboxMountPointProvider::CanHandleType(url.type())) {
+ // Sandboxed file system permissions should be implicitly granted.
+ // (And the application should not be given direct permission to the actual
+ // data directory in the sandboxed area.)
+ CHECK(mount_point_provider == context_->sandbox_provider());
+ return true;
+ }
+
file_path = mount_point_provider->GetPathForPermissionsCheck(url.path());
if (file_path.empty()) {
*error = base::PLATFORM_FILE_ERROR_SECURITY;
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698