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

Unified Diff: chrome/browser/extensions/extension_creator.cc

Issue 10912041: Disallow packing or loading unpacked manifest v1 extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blarh Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_creator.h ('k') | chrome/browser/extensions/pack_extension_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_creator.cc
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 7c24389cf944bb60b8a27b1ace8de9f0cbaf5d21..7c06df6a0e44792a72c4c50659d08399f4cc510e 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -84,7 +84,8 @@ bool ExtensionCreator::InitializeInput(
}
bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir,
- crypto::RSAPrivateKey* key_pair) {
+ crypto::RSAPrivateKey* key_pair,
+ int run_flags) {
std::vector<uint8> public_key_bytes;
if (!key_pair->ExportPublicKey(&public_key_bytes)) {
error_message_ =
@@ -102,12 +103,17 @@ bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir,
// Load the extension once. We don't really need it, but this does a lot of
// useful validation of the structure.
+ int create_flags =
+ Extension::FOLLOW_SYMLINKS_ANYWHERE | Extension::ERROR_ON_PRIVATE_KEY;
+ if (run_flags & kRequireModernManifestVersion)
+ create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION;
+
scoped_refptr<Extension> extension(
extension_file_util::LoadExtension(
extension_dir,
extension_id,
Extension::INTERNAL,
- Extension::FOLLOW_SYMLINKS_ANYWHERE | Extension::ERROR_ON_PRIVATE_KEY,
+ create_flags,
&error_message_));
return !!extension.get();
}
@@ -297,7 +303,9 @@ bool ExtensionCreator::Run(const FilePath& extension_dir,
return false;
// Perform some extra validation by loading the extension.
- if (!ValidateManifest(extension_dir, key_pair.get()))
+ // TODO(aa): Can this go before creating the key pair? This would mean not
+ // passing ID into LoadExtension which seems OK.
+ if (!ValidateManifest(extension_dir, key_pair.get(), run_flags))
return false;
ScopedTempDir temp_dir;
« no previous file with comments | « chrome/browser/extensions/extension_creator.h ('k') | chrome/browser/extensions/pack_extension_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698