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

Unified Diff: Source/core/dom/Element.cpp

Issue 1171223004: Sanitize SVG animation attributes which could set JavaScript URL values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Thanks for feedback. Created 5 years, 6 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 | « Source/core/dom/Element.h ('k') | Source/core/editing/Editor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 29b4db06fdf6d4fd32fe08c5276991ba52010a8a..61995af8041ea76bada76e060b3e23d21cb3cf39 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1245,9 +1245,14 @@ static inline bool isEventHandlerAttribute(const Attribute& attribute)
return attribute.name().namespaceURI().isNull() && attribute.name().localName().startsWith("on");
}
+bool Element::attributeValueIsJavaScriptURL(const Attribute& attribute)
+{
+ return protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(attribute.value()));
+}
+
bool Element::isJavaScriptURLAttribute(const Attribute& attribute) const
{
- return isURLAttribute(attribute) && protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(attribute.value()));
+ return isURLAttribute(attribute) && attributeValueIsJavaScriptURL(attribute);
}
void Element::stripScriptingAttributes(Vector<Attribute>& attributeVector) const
@@ -1256,7 +1261,8 @@ void Element::stripScriptingAttributes(Vector<Attribute>& attributeVector) const
for (size_t source = 0; source < attributeVector.size(); ++source) {
if (isEventHandlerAttribute(attributeVector[source])
|| isJavaScriptURLAttribute(attributeVector[source])
- || isHTMLContentAttribute(attributeVector[source]))
+ || isHTMLContentAttribute(attributeVector[source])
+ || isSVGAnimationAttributeSettingJavaScriptURL(attributeVector[source]))
continue;
if (source != destination)
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/editing/Editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698