Chromium Code Reviews| Index: chrome/utility/chrome_content_utility_client.cc |
| diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc |
| index b8f83f05c01132a69070929806b3baef7ea0d665..1f2760b999da046fa8a56a516cafe561c2f0ea4e 100644 |
| --- a/chrome/utility/chrome_content_utility_client.cc |
| +++ b/chrome/utility/chrome_content_utility_client.cc |
| @@ -67,6 +67,11 @@ namespace chrome { |
| namespace { |
| +// This whitelist is the default list of whitelist entries when running |
| +// elevated. |
| +static const uint32 kMessageWhitelist[] = { 0 }; |
| +static const size_t kMessageWhitelistSize = arraysize(kMessageWhitelist); |
|
jam
2014/02/04 23:29:06
since you want to add owners checks for this list,
Jorge Lucangeli Obes
2014/02/05 00:15:55
Yes, this is exactly what I was suggesting.
Drew Haven
2014/02/05 02:36:31
Done. I hope I set it up correctly with a .h file
|
| + |
| bool Send(IPC::Message* message) { |
| return content::UtilityThread::Get()->Send(message); |
| } |
| @@ -77,7 +82,8 @@ void ReleaseProcessIfNeeded() { |
| } // namespace |
| -ChromeContentUtilityClient::ChromeContentUtilityClient() { |
| +ChromeContentUtilityClient::ChromeContentUtilityClient() |
| + : filter_messages_(false) { |
| #if !defined(OS_ANDROID) |
| handlers_.push_back(new ProfileImportHandler()); |
| #endif // OS_ANDROID |
| @@ -109,10 +115,26 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { |
| std::string lang = command_line->GetSwitchValueASCII(switches::kLang); |
| if (!lang.empty()) |
| extension_l10n_util::SetProcessLocale(lang); |
| + |
| + if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) { |
| + DVLOG(0) << "Utility process is running elevated, restricting messages."; |
| + for (size_t i = 0; i < kMessageWhitelistSize; i++) { |
| + message_id_whitelist_.insert(kMessageWhitelist[i]); |
| + } |
| + filter_messages_ = true; |
| + } |
| } |
| bool ChromeContentUtilityClient::OnMessageReceived( |
| const IPC::Message& message) { |
| + if (filter_messages_ |
| + && message_id_whitelist_.find(message.type()) |
| + == message_id_whitelist_.end()) { |
| + DVLOG(0) << "Message rejected, not in whitelist: " |
| + << message.type(); |
| + return false; |
| + } |
| + |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message) |
| IPC_MESSAGE_HANDLER(ChromeUtilityMsg_UnpackExtension, OnUnpackExtension) |