diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-02 15:18:12 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-02 15:18:12 +0000 |
commit | b7462f3199f5709fb77f575cfb523b203bf59fb3 (patch) | |
tree | 335f5e6b48e784b74b08f9fcdbccdbcd8660e1d7 /chrome/browser/extensions/extension_creator.cc | |
parent | 52890868a952de381ca41b9b0a29ab46975d363a (diff) | |
download | chromium_src-b7462f3199f5709fb77f575cfb523b203bf59fb3.zip chromium_src-b7462f3199f5709fb77f575cfb523b203bf59fb3.tar.gz chromium_src-b7462f3199f5709fb77f575cfb523b203bf59fb3.tar.bz2 |
Disallow packing or loading unpacked manifest v1 extensions.
BUG=132718
Review URL: https://chromiumcodereview.appspot.com/10912041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_creator.cc')
-rw-r--r-- | chrome/browser/extensions/extension_creator.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 7c24389..7c06df6 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; |