summaryrefslogtreecommitdiffstats
path: root/extensions/browser/guest_view
diff options
context:
space:
mode:
authorapacible <apacible@chromium.org>2015-11-13 12:15:29 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 20:17:04 +0000
commit1c7a1c7c49cda812367bce5b6a554a7af28f2fb3 (patch)
tree873e4b3f9617017f83c3050b5f9e0986cf5e06cb /extensions/browser/guest_view
parentc62b5f5d9b91ad5102830ae7669d8f7f6746bcda (diff)
downloadchromium_src-1c7a1c7c49cda812367bce5b6a554a7af28f2fb3.zip
chromium_src-1c7a1c7c49cda812367bce5b6a554a7af28f2fb3.tar.gz
chromium_src-1c7a1c7c49cda812367bce5b6a554a7af28f2fb3.tar.bz2
[Reland] [ExtensionView] Add extension id whitelisting for ExtensionView.
Per discussion with Chrome Eng Review, all extension ids that can be loaded by ExtensionView will be explicitly whitelisted in extension_view_whitelist.cc/h. This change whitelists the extension id used in browser tests, as well extension ids related to Media Router. This also removes some old logging and simplifies the test skeleton extensions. This is a reland of https://codereview.chromium.org/1419143009. BUG=552207, 552208 Review URL: https://codereview.chromium.org/1438733003 Cr-Commit-Position: refs/heads/master@{#359605}
Diffstat (limited to 'extensions/browser/guest_view')
-rw-r--r--extensions/browser/guest_view/extension_view/extension_view_guest.cc4
-rw-r--r--extensions/browser/guest_view/extension_view/whitelist/OWNERS11
-rw-r--r--extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.cc42
-rw-r--r--extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h17
4 files changed, 73 insertions, 1 deletions
diff --git a/extensions/browser/guest_view/extension_view/extension_view_guest.cc b/extensions/browser/guest_view/extension_view/extension_view_guest.cc
index e000d6e..0a341ff 100644
--- a/extensions/browser/guest_view/extension_view/extension_view_guest.cc
+++ b/extensions/browser/guest_view/extension_view/extension_view_guest.cc
@@ -11,6 +11,7 @@
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/bad_message.h"
#include "extensions/browser/guest_view/extension_view/extension_view_constants.h"
+#include "extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/strings/grit/extensions_strings.h"
@@ -71,7 +72,8 @@ void ExtensionViewGuest::CreateWebContents(
std::string extension_id;
create_params.GetString(extensionview::kAttributeExtension, &extension_id);
- if (!crx_file::id_util::IdIsValid(extension_id)) {
+ if (!crx_file::id_util::IdIsValid(extension_id) ||
+ !IsExtensionIdWhitelisted(extension_id)) {
callback.Run(nullptr);
return;
}
diff --git a/extensions/browser/guest_view/extension_view/whitelist/OWNERS b/extensions/browser/guest_view/extension_view/whitelist/OWNERS
new file mode 100644
index 0000000..4b00898
--- /dev/null
+++ b/extensions/browser/guest_view/extension_view/whitelist/OWNERS
@@ -0,0 +1,11 @@
+# Whitelisting new extension ids for ExtensionView use requires approval from
+# chrome-eng-review@google.com.
+set noparent
+
+ben@chromium.org
+brettw@chromium.org
+cpu@chromium.org
+darin@chromium.org
+dglazkov@chromium.org
+jam@chromium.org
+jochen@chromium.org \ No newline at end of file
diff --git a/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.cc b/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.cc
new file mode 100644
index 0000000..ed62427
--- /dev/null
+++ b/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h"
+
+#include "base/logging.h"
+#include "base/macros.h"
+
+namespace extensions {
+
+namespace {
+
+// =============================================================================
+//
+// ADDING NEW EXTENSIONS REQUIRES APPROVAL from chrome-eng-review@google.com
+//
+// =============================================================================
+
+const char* const kWhitelist[] = {
+ "pemeknaakobkocgmimdeamlcklioagkh", // Used in browser tests
+ "dppcjffonoklmpdmljnpdojmoaefcabf", // Used in browser tests
+ "fjhoaacokmgbjemoflkofnenfaiekifl", // http://crbug.com/552208
+ "ekpaaapppgpmolpcldedioblbkmijaca", // http://crbug.com/552208
+ "lhkfccafpkdlaodkicmokbmfapjadkij", // http://crbug.com/552208
+ "ibiljbkambkbohapfhoonkcpcikdglop", // http://crbug.com/552208
+ "enhhojjnijigcajfphajepfemndkmdlo", // http://crbug.com/552208
+};
+
+} // namespace
+
+// static
+bool IsExtensionIdWhitelisted(const std::string& extension_id) {
+ for (size_t i = 0; i < arraysize(kWhitelist); ++i) {
+ if (extension_id == kWhitelist[i])
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace extensions
diff --git a/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h b/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h
new file mode 100644
index 0000000..512600b
--- /dev/null
+++ b/extensions/browser/guest_view/extension_view/whitelist/extension_view_whitelist.h
@@ -0,0 +1,17 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_WHITELIST_EXTENSION_VIEW_WHITELIST_H_
+#define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_WHITELIST_EXTENSION_VIEW_WHITELIST_H_
+
+#include <string>
+
+namespace extensions {
+
+// Checks whether |extension_id| is whitelisted to be used by ExtensionView.
+bool IsExtensionIdWhitelisted(const std::string& extension_id);
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_WHITELIST_EXTENSION_VIEW_WHITELIST_H_