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

Side by Side Diff: chrome/browser/utility_process_host.cc

Issue 2088006: Give the extension unpacker process a junction/symlink free path to the unpack directory. (Closed)
Patch Set: Rebase for commit. Created 10 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/utility_process_host.h" 5 #include "chrome/browser/utility_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/utility_messages.h" 14 #include "chrome/common/utility_messages.h"
15 #include "ipc/ipc_switches.h" 15 #include "ipc/ipc_switches.h"
16 16
17 UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, 17 UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh,
18 Client* client, 18 Client* client,
19 ChromeThread::ID client_thread_id) 19 ChromeThread::ID client_thread_id)
20 : ChildProcessHost(UTILITY_PROCESS, rdh), 20 : ChildProcessHost(UTILITY_PROCESS, rdh),
21 client_(client), 21 client_(client),
22 client_thread_id_(client_thread_id) { 22 client_thread_id_(client_thread_id) {
23 } 23 }
24 24
25 UtilityProcessHost::~UtilityProcessHost() { 25 UtilityProcessHost::~UtilityProcessHost() {
26 } 26 }
27 27
28 bool UtilityProcessHost::StartExtensionUnpacker(const FilePath& extension) { 28 bool UtilityProcessHost::StartExtensionUnpacker(const FilePath& extension) {
29 FilePath initial_path = extension.DirName();
30 FilePath real_path;
31
32 // The utility process will have access to the directory passed to
33 // StartProcess(). That directory should not be a symlink or NTFS
34 // junctions, because when the path is used, following the link will
35 // cause file system access outside the sandbox path.
36
37 #if defined(OS_POSIX)
38 // Resolve symlinks to get a symlink free path.
39 if (!file_util::RealPath(initial_path, &real_path)) {
40 real_path = initial_path;
41 }
42 #else
43 // TODO(skerner): For windows, we need to expand NTFS junctions.
44 // http://crbug.com/13044
45 real_path = initial_path;
46 #endif
47
48 // TODO(skerner): Remove this logging once we understand crbug.com/35198
49 LOG(INFO) << "initial_path: " << initial_path.value();
50 LOG(INFO) << "real_path: " << real_path.value();
51
52 // Grant the subprocess access to the entire subdir the extension file is 29 // Grant the subprocess access to the entire subdir the extension file is
53 // in, so that it can unpack to that dir. 30 // in, so that it can unpack to that dir.
54 if (!StartProcess(real_path)) 31 if (!StartProcess(extension.DirName()))
55 return false; 32 return false;
56 33
57 Send(new UtilityMsg_UnpackExtension(extension)); 34 Send(new UtilityMsg_UnpackExtension(extension));
58 return true; 35 return true;
59 } 36 }
60 37
61 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) { 38 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) {
62 if (!StartProcess(FilePath())) 39 if (!StartProcess(FilePath()))
63 return false; 40 return false;
64 41
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, 154 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded,
178 Client::OnParseUpdateManifestSucceeded) 155 Client::OnParseUpdateManifestSucceeded)
179 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, 156 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed,
180 Client::OnParseUpdateManifestFailed) 157 Client::OnParseUpdateManifestFailed)
181 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded, 158 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded,
182 Client::OnDecodeImageSucceeded) 159 Client::OnDecodeImageSucceeded)
183 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, 160 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed,
184 Client::OnDecodeImageFailed) 161 Client::OnDecodeImageFailed)
185 IPC_END_MESSAGE_MAP_EX() 162 IPC_END_MESSAGE_MAP_EX()
186 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698