fix(mail(html)): ban "javascript:" prefix in href, action and formaction

This commit is contained in:
Francis Lachapelle
2021-12-01 11:34:37 -05:00
parent 426b28eda7
commit 8afc80d82e

View File

@@ -520,10 +520,11 @@ _xmlCharsetForCharset (NSString *charset)
{
value = [_attributes valueAtIndex: count];
lowerValue = [value lowercaseString];
skipAttribute = ([lowerValue rangeOfString: @"://"].location == NSNotFound
&& ![lowerValue hasPrefix: @"mailto:"]
&& ![lowerValue hasPrefix: @"#"]) ||
[lowerValue hasPrefix: @"javascript:"];
skipAttribute =
([lowerValue rangeOfString: @"://"].location == NSNotFound
&& ![lowerValue hasPrefix: @"mailto:"]
&& ![lowerValue hasPrefix: @"#"])
|| [lowerValue rangeOfString: @"javascript:"].location != NSNotFound;
if (!skipAttribute)
[resultPart appendString: @" rel=\"noopener\""];
}