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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1852153002: Avoid adding Mojo service to the utility process when running with elevated privileges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 for (Handlers::iterator it = handlers_.begin(); 190 for (Handlers::iterator it = handlers_.begin();
191 !handled && it != handlers_.end(); ++it) { 191 !handled && it != handlers_.end(); ++it) {
192 handled = (*it)->OnMessageReceived(message); 192 handled = (*it)->OnMessageReceived(message);
193 } 193 }
194 194
195 return handled; 195 return handled;
196 } 196 }
197 197
198 void ChromeContentUtilityClient::RegisterMojoServices( 198 void ChromeContentUtilityClient::RegisterMojoServices(
199 content::ServiceRegistry* registry) { 199 content::ServiceRegistry* registry) {
200 // When the utility process is running with elevated privileges, we need to
201 // filter messages so that only a whitelist of IPCs can run. In Mojo, there's
202 // no way of filtering individual messages. Instead, we can avoid adding
203 // non-whitelisted Mojo services to the ServiceRegistry.
204 // TODO(amistry): Use a whitelist once the whistlisted IPCs have been
205 // converted to Mojo.
206 if (filter_messages_)
207 return;
208
200 #if !defined(OS_ANDROID) 209 #if !defined(OS_ANDROID)
201 registry->AddService<net::interfaces::ProxyResolverFactory>( 210 registry->AddService<net::interfaces::ProxyResolverFactory>(
202 base::Bind(CreateProxyResolverFactory)); 211 base::Bind(CreateProxyResolverFactory));
203 registry->AddService<ResourceUsageReporter>( 212 registry->AddService<ResourceUsageReporter>(
204 base::Bind(CreateResourceUsageReporter)); 213 base::Bind(CreateResourceUsageReporter));
205 #endif 214 #endif
206 } 215 }
207 216
208 void ChromeContentUtilityClient::AddHandler( 217 void ChromeContentUtilityClient::AddHandler(
209 scoped_ptr<UtilityMessageHandler> handler) { 218 scoped_ptr<UtilityMessageHandler> handler) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 safe_browsing::zip_analyzer::Results results; 414 safe_browsing::zip_analyzer::Results results;
406 safe_browsing::dmg::AnalyzeDMGFile( 415 safe_browsing::dmg::AnalyzeDMGFile(
407 IPC::PlatformFileForTransitToFile(dmg_file), &results); 416 IPC::PlatformFileForTransitToFile(dmg_file), &results);
408 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( 417 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished(
409 results)); 418 results));
410 ReleaseProcessIfNeeded(); 419 ReleaseProcessIfNeeded();
411 } 420 }
412 #endif // defined(OS_MACOSX) 421 #endif // defined(OS_MACOSX)
413 422
414 #endif // defined(FULL_SAFE_BROWSING) 423 #endif // defined(FULL_SAFE_BROWSING)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698