Skip to content

Commit

Permalink
fix(mail(html)): ban "javascript:" prefix in href, action and formaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Dec 1, 2021
1 parent 426b28e commit 8afc80d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions UI/MailPartViewers/UIxMailPartHTMLViewer.m
Expand Up @@ -520,10 +520,11 @@ - (void) startElement: (NSString *) _localName
{
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\""];
}
Expand Down

0 comments on commit 8afc80d

Please sign in to comment.