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

Unified Diff: chrome/renderer/extensions/extension_resource_request_policy.cc

Issue 8849010: Add 'web_accessible_resource" keyword for version 2 extension manifests. This makes extension res... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/extension_resource_request_policy.cc
===================================================================
--- chrome/renderer/extensions/extension_resource_request_policy.cc (revision 114987)
+++ chrome/renderer/extensions/extension_resource_request_policy.cc (working copy)
@@ -4,7 +4,9 @@
#include "chrome/renderer/extensions/extension_resource_request_policy.h"
+#include "base/command_line.h"
#include "base/logging.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
@@ -38,6 +40,22 @@
return false;
}
+ // Disallow loading of extension resources which are not explicitely listed
+ // as web accessible if the manifest version is 2 or greater.
+
+ // Exceptions are:
+ // - empty origin (needed for some edge cases when we have empty origins)
+ // - chrome-extension:// (for legacy reasons -- some extensions interop)
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensionsResourceWhitelist) &&
+ !frame_url.is_empty() &&
+ !frame_url.SchemeIs(chrome::kExtensionScheme) &&
+ !extension->IsResourceWebAccessible(resource_url.path())) {
+ LOG(ERROR) << "Denying load of " << resource_url.spec() << " which "
+ << "is not a web accessible resource.";
+ return false;
+ }
+
return true;
}
« no previous file with comments | « chrome/common/extensions/manifest_unittest.cc ('k') | chrome/test/data/devtools/extensions/devtools_extension/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698