diff options
author | apacible <apacible@chromium.org> | 2015-11-10 20:33:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-11 04:34:22 +0000 |
commit | 47fa637f50f0bbf984b14b8dacbf8ed66e552091 (patch) | |
tree | 48f797fdbe50f478e8c70a1a5cd50b3cc1b4b567 /extensions/browser/guest_view | |
parent | c82ee4e3939795773925e4f8b7fe41b2ad8054c8 (diff) | |
download | chromium_src-47fa637f50f0bbf984b14b8dacbf8ed66e552091.zip chromium_src-47fa637f50f0bbf984b14b8dacbf8ed66e552091.tar.gz chromium_src-47fa637f50f0bbf984b14b8dacbf8ed66e552091.tar.bz2 |
[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.
BUG=552207, 552208
Review URL: https://codereview.chromium.org/1419143009
Cr-Commit-Position: refs/heads/master@{#359053}
Diffstat (limited to 'extensions/browser/guest_view')
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..dbd9c11 --- /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 std::string 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_ |