summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 06:53:25 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 06:53:25 +0000
commitd12dcdd649f0f1181ecae1f0f567c6a453a5a96d (patch)
tree5631de8aaf766884b3aae73327f2f94d9c26461b /webkit/plugins
parent5a53b62b3e52202f530447f4fdf3637e39a56c35 (diff)
downloadchromium_src-d12dcdd649f0f1181ecae1f0f567c6a453a5a96d.zip
chromium_src-d12dcdd649f0f1181ecae1f0f567c6a453a5a96d.tar.gz
chromium_src-d12dcdd649f0f1181ecae1f0f567c6a453a5a96d.tar.bz2
Put some plug-ins behind an infobar, where they have:
- Been targeted by mass malware. - Do not yet have a good sandboxing story. BUG=60458 TEST=http://java.sun.com/products/plugin/1.4/demos/applets/Blink/example1.html with default plug-in settings. Review URL: http://codereview.chromium.org/6350010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/npapi/plugin_group.cc16
-rw-r--r--webkit/plugins/npapi/plugin_group.h9
-rw-r--r--webkit/plugins/npapi/plugin_group_unittest.cc22
-rw-r--r--webkit/plugins/npapi/plugin_list.cc72
4 files changed, 73 insertions, 46 deletions
diff --git a/webkit/plugins/npapi/plugin_group.cc b/webkit/plugins/npapi/plugin_group.cc
index a20c3be..1884650 100644
--- a/webkit/plugins/npapi/plugin_group.cc
+++ b/webkit/plugins/npapi/plugin_group.cc
@@ -18,6 +18,9 @@ namespace npapi {
const char* PluginGroup::kAdobeReaderGroupName = "Adobe Acrobat";
const char* PluginGroup::kAdobeReaderUpdateURL = "http://get.adobe.com/reader/";
+const char* PluginGroup::kJavaGroupName = "Java";
+const char* PluginGroup::kQuickTimeGroupName = "QuickTime";
+const char* PluginGroup::kShockwaveGroupName = "Shockwave";
/*static*/
std::set<string16>* PluginGroup::policy_disabled_plugin_patterns_;
@@ -50,7 +53,8 @@ bool PluginGroup::IsPluginNameDisabledByPolicy(const string16& plugin_name) {
VersionRange::VersionRange(VersionRangeDefinition definition)
: low_str(definition.version_matcher_low),
high_str(definition.version_matcher_high),
- min_str(definition.min_version) {
+ min_str(definition.min_version),
+ requires_authorization(definition.requires_authorization) {
if (!low_str.empty())
low.reset(Version::GetVersionFromString(low_str));
if (!high_str.empty())
@@ -77,6 +81,7 @@ void VersionRange::InitFrom(const VersionRange& other) {
low.reset(Version::GetVersionFromString(other.low_str));
high.reset(Version::GetVersionFromString(other.high_str));
min.reset(Version::GetVersionFromString(other.min_str));
+ requires_authorization = other.requires_authorization;
}
PluginGroup::PluginGroup(const string16& group_name,
@@ -401,6 +406,15 @@ bool PluginGroup::IsVulnerable() const {
return false;
}
+bool PluginGroup::RequiresAuthorization() const {
+ for (size_t i = 0; i < version_ranges_.size(); ++i) {
+ if (IsVersionInRange(*version_, version_ranges_[i]) &&
+ version_ranges_[i].requires_authorization)
+ return true;
+ }
+ return false;
+}
+
bool PluginGroup::IsEmpty() const {
return web_plugin_infos_.size() == 0;
}
diff --git a/webkit/plugins/npapi/plugin_group.h b/webkit/plugins/npapi/plugin_group.h
index cc5ff7c..3f4007f 100644
--- a/webkit/plugins/npapi/plugin_group.h
+++ b/webkit/plugins/npapi/plugin_group.h
@@ -38,6 +38,7 @@ struct VersionRangeDefinition {
// to match anything higher than |version_matcher_low|.
const char* version_matcher_high;
const char* min_version; // Minimum secure version.
+ bool requires_authorization; // If this range needs user permission to run.
};
// Hard-coded definitions of plugin groups.
@@ -64,6 +65,7 @@ struct VersionRange {
scoped_ptr<Version> low;
scoped_ptr<Version> high;
scoped_ptr<Version> min;
+ bool requires_authorization;
private:
void InitFrom(const VersionRange& other);
};
@@ -81,6 +83,9 @@ class PluginGroup {
// enabled.
static const char* kAdobeReaderGroupName;
static const char* kAdobeReaderUpdateURL;
+ static const char* kJavaGroupName;
+ static const char* kQuickTimeGroupName;
+ static const char* kShockwaveGroupName;
PluginGroup(const PluginGroup& other);
@@ -160,6 +165,10 @@ class PluginGroup {
// security problems.
bool IsVulnerable() const;
+ // Returns true if this plug-in group always requires user authorization
+ // to run.
+ bool RequiresAuthorization() const;
+
// Check if the group has no plugins. Could happen after a reload if the plug-
// in has disappeared from the pc (or in the process of updating).
bool IsEmpty() const;
diff --git a/webkit/plugins/npapi/plugin_group_unittest.cc b/webkit/plugins/npapi/plugin_group_unittest.cc
index a4ea89b..54bc25d 100644
--- a/webkit/plugins/npapi/plugin_group_unittest.cc
+++ b/webkit/plugins/npapi/plugin_group_unittest.cc
@@ -20,17 +20,17 @@ namespace webkit {
namespace npapi {
static const VersionRangeDefinition kPluginVersionRange[] = {
- { "", "", "3.0.44" }
+ { "", "", "3.0.44", false }
};
static const VersionRangeDefinition kPlugin3VersionRange[] = {
- { "0", "4", "3.0.44" }
+ { "0", "4", "3.0.44", false }
};
static const VersionRangeDefinition kPlugin4VersionRange[] = {
- { "4", "5", "4.0.44" }
+ { "4", "5", "4.0.44", false }
};
static const VersionRangeDefinition kPlugin34VersionRange[] = {
- { "0", "4", "3.0.44" },
- { "4", "5", "" }
+ { "0", "4", "3.0.44", false },
+ { "4", "5", "", false }
};
static const PluginGroupDefinition kPluginDef = {
@@ -227,9 +227,9 @@ TEST(PluginGroupTest, DisabledByPolicy) {
TEST(PluginGroupTest, IsVulnerable) {
// Adobe Reader 10
VersionRangeDefinition adobe_reader_version_range[] = {
- { "10", "11", "" },
- { "9", "10", "9.4.1" },
- { "0", "9", "8.2.5" }
+ { "10", "11", "", false },
+ { "9", "10", "9.4.1", false },
+ { "0", "9", "8.2.5", false }
};
PluginGroupDefinition adobe_reader_plugin_def = {
"adobe-reader", "Adobe Reader", "Adobe Acrobat",
@@ -244,11 +244,12 @@ TEST(PluginGroupTest, IsVulnerable) {
group->AddPlugin(adobe_reader_plugin);
PluginGroup group_copy(*group); // Exercise the copy constructor.
EXPECT_FALSE(group_copy.IsVulnerable());
+ EXPECT_FALSE(group_copy.RequiresAuthorization());
// Silverlight 4
VersionRangeDefinition silverlight_version_range[] = {
- { "0", "4", "3.0.50106.0" },
- { "4", "5", "" }
+ { "0", "4", "3.0.50106.0", false },
+ { "4", "5", "", true }
};
PluginGroupDefinition silverlight_plugin_def = {
"silverlight", "Silverlight", "Silverlight", silverlight_version_range,
@@ -261,6 +262,7 @@ TEST(PluginGroupTest, IsVulnerable) {
group.reset(PluginGroupTest::CreatePluginGroup(silverlight_plugin_def));
group->AddPlugin(silverlight_plugin);
EXPECT_FALSE(PluginGroup(*group).IsVulnerable());
+ EXPECT_TRUE(PluginGroup(*group).RequiresAuthorization());
}
} // namespace npapi
} // namespace webkit
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index a4da48d..0d4519c 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -29,7 +29,7 @@ FilePath::CharType kDefaultPluginLibraryName[] =
// Some version ranges can be shared across operating systems. This should be
// done where possible to avoid duplication.
static const VersionRangeDefinition kFlashVersionRange[] = {
- { "", "", "10.1.102" }
+ { "", "", "10.1.102", false }
};
// Similarly, try and share the group definition for plug-ins that are
@@ -44,36 +44,38 @@ static const PluginGroupDefinition kFlashDefinition = {
// (new versions) are published.
// TODO(panayiotis): Get the Real Player version on Mac, somehow.
static const VersionRangeDefinition kQuicktimeVersionRange[] = {
- { "", "", "7.6.6" }
+ { "", "", "7.6.6", true }
};
static const VersionRangeDefinition kJavaVersionRange[] = {
- { "13.0", "14.0", "13.3.0" } // Snow Leopard
+ { "13.0", "14.0", "13.3.0", true } // Snow Leopard
};
static const VersionRangeDefinition kSilverlightVersionRange[] = {
- { "0", "4", "3.0.50106.0" },
- { "4", "5", "" }
+ { "0", "4", "3.0.50106.0", false },
+ { "4", "5", "", false }
};
static const VersionRangeDefinition kFlip4MacVersionRange[] = {
- { "", "", "2.2.1" }
+ { "", "", "2.2.1", false }
};
static const VersionRangeDefinition kShockwaveVersionRange[] = {
- { "", "", "11.5.9.615" }
+ { "", "", "11.5.9.615", true }
};
+// TODO(cevans) - I don't see Adobe Reader in here for Mac.
static const PluginGroupDefinition kGroupDefinitions[] = {
kFlashDefinition,
- { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange,
- arraysize(kQuicktimeVersionRange),
+ { "apple-quicktime", PluginGroup::kQuickTimeGroupName, "QuickTime Plug-in",
+ kQuicktimeVersionRange, arraysize(kQuicktimeVersionRange),
"http://www.apple.com/quicktime/download/" },
- { "java-runtime-environment", "Java", "Java", kJavaVersionRange,
- arraysize(kJavaVersionRange), "http://support.apple.com/kb/HT1338" },
+ { "java-runtime-environment", PluginGroup::kJavaGroupName, "Java",
+ kJavaVersionRange, arraysize(kJavaVersionRange),
+ "http://support.apple.com/kb/HT1338" },
{ "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange,
arraysize(kSilverlightVersionRange),
"http://www.microsoft.com/getsilverlight/" },
{ "flip4mac", "Flip4Mac", "Flip4Mac", kFlip4MacVersionRange,
arraysize(kFlip4MacVersionRange),
"http://www.telestream.net/flip4mac-wmv/overview.htm" },
- { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange,
- arraysize(kShockwaveVersionRange),
+ { "shockwave", PluginGroup::kShockwaveGroupName, "Shockwave for Director",
+ kShockwaveVersionRange, arraysize(kShockwaveVersionRange),
"http://www.adobe.com/shockwave/download/" }
};
@@ -81,41 +83,41 @@ static const PluginGroupDefinition kGroupDefinitions[] = {
// TODO(panayiotis): We should group "RealJukebox NS Plugin" with the rest of
// the RealPlayer files.
static const VersionRangeDefinition kQuicktimeVersionRange[] = {
- { "", "", "7.6.8" }
+ { "", "", "7.6.8", true }
};
static const VersionRangeDefinition kJavaVersionRange[] = {
- { "0", "7", "6.0.220" } // "220" is not a typo.
+ { "0", "7", "6.0.220", true } // "220" is not a typo.
};
static const VersionRangeDefinition kAdobeReaderVersionRange[] = {
- { "10", "11", "" },
- { "9", "10", "9.4.1" },
- { "0", "9", "8.2.5" }
+ { "10", "11", "", false },
+ { "9", "10", "9.4.1", false },
+ { "0", "9", "8.2.5", false }
};
static const VersionRangeDefinition kSilverlightVersionRange[] = {
- { "0", "4", "3.0.50106.0" },
- { "4", "5", "" }
+ { "0", "4", "3.0.50106.0", false },
+ { "4", "5", "", false }
};
static const VersionRangeDefinition kShockwaveVersionRange[] = {
- { "", "", "11.5.9.615" }
+ { "", "", "11.5.9.615", true }
};
static const VersionRangeDefinition kDivXVersionRange[] = {
- { "", "", "1.4.3.4" }
+ { "", "", "1.4.3.4", false }
};
static const PluginGroupDefinition kGroupDefinitions[] = {
kFlashDefinition,
- { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange,
- arraysize(kQuicktimeVersionRange),
+ { "apple-quicktime", PluginGroup::kQuickTimeGroupName, "QuickTime Plug-in",
+ kQuicktimeVersionRange, arraysize(kQuicktimeVersionRange),
"http://www.apple.com/quicktime/download/" },
- { "java-runtime-environment", "Java 6", "Java", kJavaVersionRange,
- arraysize(kJavaVersionRange), "http://www.java.com/" },
+ { "java-runtime-environment", PluginGroup::kJavaGroupName, "Java",
+ kJavaVersionRange, arraysize(kJavaVersionRange), "http://www.java.com/" },
{ "adobe-reader", PluginGroup::kAdobeReaderGroupName, "Adobe Acrobat",
kAdobeReaderVersionRange, arraysize(kAdobeReaderVersionRange),
"http://get.adobe.com/reader/" },
{ "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange,
arraysize(kSilverlightVersionRange),
"http://www.microsoft.com/getsilverlight/" },
- { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange,
- arraysize(kShockwaveVersionRange),
+ { "shockwave", PluginGroup::kShockwaveGroupName, "Shockwave for Director",
+ kShockwaveVersionRange, arraysize(kShockwaveVersionRange),
"http://www.adobe.com/shockwave/download/" },
{ "divx-player", "DivX Player", "DivX Web Player", kDivXVersionRange,
arraysize(kDivXVersionRange),
@@ -135,23 +137,23 @@ static const PluginGroupDefinition kGroupDefinitions[] = {
#else
static const VersionRangeDefinition kJavaVersionRange[] = {
- { "0", "1.7", "1.6.0.22" }
+ { "0", "1.7", "1.6.0.22", true }
};
static const VersionRangeDefinition kRedhatIcedTeaVersionRange[] = {
- { "0", "1.9", "1.8.3" },
- { "1.9", "1.10", "1.9.2" },
+ { "0", "1.9", "1.8.3", true },
+ { "1.9", "1.10", "1.9.2", true },
};
static const PluginGroupDefinition kGroupDefinitions[] = {
// Flash on Linux is significant because there isn't yet a built-in Flash
// plug-in on the Linux 64-bit version of Chrome.
kFlashDefinition,
- { "java-runtime-environment", "Java 6", "Java", kJavaVersionRange,
- arraysize(kJavaVersionRange),
+ { "java-runtime-environment", PluginGroup::kJavaGroupName, "Java",
+ kJavaVersionRange, arraysize(kJavaVersionRange),
"http://www.java.com/en/download/manual.jsp" },
- { "redhat-icetea-java", "IcedTea", "IcedTea", kRedhatIcedTeaVersionRange,
- arraysize(kRedhatIcedTeaVersionRange),
+ { "redhat-icetea-java", "IceTea", "IcedTea",
+ kRedhatIcedTeaVersionRange, arraysize(kRedhatIcedTeaVersionRange),
"http://www.linuxsecurity.com/content/section/3/170/" },
};
#endif