mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-09 05:25:26 +00:00
fix(mail): sanitise mail with ics (invitation to event)
This commit is contained in:
@@ -1031,16 +1031,26 @@ static int cssEscapingCount;
|
||||
newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"</for*"];
|
||||
result = [NSString stringWithString: newResult];
|
||||
|
||||
// Remove onload
|
||||
regex = [NSRegularExpression regularExpressionWithPattern:@"onload="
|
||||
options: NSRegularExpressionCaseInsensitive error:&error];
|
||||
newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"onl***="];
|
||||
result = [NSString stringWithString: newResult];
|
||||
// // Remove onload
|
||||
// regex = [NSRegularExpression regularExpressionWithPattern:@"onload="
|
||||
// options: NSRegularExpressionCaseInsensitive error:&error];
|
||||
// newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"onl***="];
|
||||
// result = [NSString stringWithString: newResult];
|
||||
|
||||
// Remove onmouseover
|
||||
regex = [NSRegularExpression regularExpressionWithPattern:@"onmouseover="
|
||||
options: NSRegularExpressionCaseInsensitive error:&error];
|
||||
newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"onmouseo***="];
|
||||
// // Remove onmouseover
|
||||
// regex = [NSRegularExpression regularExpressionWithPattern:@"onmouseover="
|
||||
// options: NSRegularExpressionCaseInsensitive error:&error];
|
||||
// newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"onmouseo***="];
|
||||
// result = [NSString stringWithString: newResult];
|
||||
|
||||
// regex = [NSRegularExpression regularExpressionWithPattern:@"onrepeat="
|
||||
// options: NSRegularExpressionCaseInsensitive error:&error];
|
||||
// newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"onrep***="];
|
||||
// result = [NSString stringWithString: newResult];
|
||||
|
||||
regex = [NSRegularExpression regularExpressionWithPattern: @"(on\\w+)\\s*=\\s*([\"'][^\"']*[\"']|[^\\s>]+)"
|
||||
options: NSRegularExpressionCaseInsensitive error: &error];
|
||||
newResult = [regex stringByReplacingMatchesInString: result options: 0 range: NSMakeRange(0, [result length]) withTemplate: @"on***=\"\""];
|
||||
result = [NSString stringWithString: newResult];
|
||||
|
||||
// Remove @import css (in style tags)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#import <SOGo/SOGoUserFolder.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
#import <Appointments/SOGoAppointmentFolder.h>
|
||||
#import <Appointments/SOGoAppointmentFolders.h>
|
||||
@@ -81,8 +82,7 @@
|
||||
{
|
||||
if (!inCalendar)
|
||||
{
|
||||
inCalendar
|
||||
= [iCalCalendar parseSingleFromSource: [self flatContentAsString]];
|
||||
inCalendar = [iCalCalendar parseSingleFromSource: [self flatContentAsString]];
|
||||
[inCalendar retain];
|
||||
}
|
||||
|
||||
@@ -583,7 +583,12 @@
|
||||
[[person partStatWithDefault] lowercaseString], @"partstat", nil]];
|
||||
}
|
||||
|
||||
[d setObject: a forKey: @"participants"];
|
||||
[d setObject: a forKey: @"participants"];
|
||||
|
||||
//Sanitise the html content
|
||||
if([d objectForKey:@"content"]){
|
||||
[d setObject: [[d objectForKey:@"content"] stringWithoutHTMLInjection: NO] forKey: @"content"];
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user