diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 17:58:56 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 17:58:56 +0000 |
commit | 56bf1b7944f2c7b2a620b0e1476086b7e60f0da6 (patch) | |
tree | 64424f237391708000d194dfee6253f47655a7f3 | |
parent | 1388bfa95161eee559746d14a69a3e5fb6248f58 (diff) | |
download | chromium_src-56bf1b7944f2c7b2a620b0e1476086b7e60f0da6.zip chromium_src-56bf1b7944f2c7b2a620b0e1476086b7e60f0da6.tar.gz chromium_src-56bf1b7944f2c7b2a620b0e1476086b7e60f0da6.tar.bz2 |
Prevent apps from claiming "<all_urls>". The gallery would have
prevented this before, but this makes it more explicit.
BUG=56801
TEST=unit_tests --gtest_filter=ExtensionManifestTest.*
Review URL: http://codereview.chromium.org/3524005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61198 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/extensions/extension.cc | 7 | ||||
-rw-r--r-- | chrome/common/extensions/extension_manifests_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index a9a8fc9..30a67c6 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -764,6 +764,13 @@ bool Extension::LoadExtent(const DictionaryValue* manifest, return false; } + // Do not allow authors to claim "<all_urls>". That would make no sense. + if (pattern.match_all_urls()) { + *error = ExtensionErrorUtils::FormatErrorMessage(value_error, + base::UintToString(i)); + return false; + } + // We do not allow authors to put wildcards in their paths. Instead, we // imply one at the end. if (pattern.path().find('*') != std::string::npos) { diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index a4c3a3d..5cdd909 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -153,6 +153,9 @@ TEST_F(ExtensionManifestTest, AppWebUrls) { LoadAndExpectError("web_urls_invalid_3.json", ExtensionErrorUtils::FormatErrorMessage( errors::kInvalidWebURL, "0")); + LoadAndExpectError("web_urls_invalid_4.json", + ExtensionErrorUtils::FormatErrorMessage( + errors::kInvalidWebURL, "0")); scoped_ptr<Extension> extension( LoadAndExpectSuccess("web_urls_default.json")); diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json new file mode 100644 index 0000000..58634e3 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "urls": [ + "<all_urls>" + ], + "launch": { + "web_url": "http://www.google.com/foo.html" + } + } +} |