Escape HTML in raw source of events and tasks

Fixes #3718
pull/213/head
Francis Lachapelle 2016-06-08 16:06:58 -04:00
parent 97e6385f4c
commit 64ce3c9c22
3 changed files with 8 additions and 7 deletions

1
NEWS
View File

@ -4,6 +4,7 @@
Bug fixes Bug fixes
- [web] fixed generic avatar in lists (#3719) - [web] fixed generic avatar in lists (#3719)
- [web] fixed validation in Sieve filter editor - [web] fixed validation in Sieve filter editor
- [web] properly encode events and tasks rawsource to avoid XSS issues (#3718)
3.1.2 (2016-06-06) 3.1.2 (2016-06-06)
------------------ ------------------

View File

@ -875,7 +875,7 @@ static NSArray *reminderValues = nil;
[content appendFormat: @"%@", [[self clientObject] contentAsString]]; [content appendFormat: @"%@", [[self clientObject] contentAsString]];
[response setHeader: @"text/plain; charset=utf-8" [response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"]; forKey: @"content-type"];
[response appendContentString: content]; [response appendContentString: [content stringByEscapingHTMLString]];
return response; return response;
} }

View File

@ -167,23 +167,23 @@
template: [ template: [
'<md-dialog flex="40" flex-sm="80" flex-xs="100" aria-label="' + l('View Raw Source') + '">', '<md-dialog flex="40" flex-sm="80" flex-xs="100" aria-label="' + l('View Raw Source') + '">',
' <md-dialog-content class="md-dialog-content">', ' <md-dialog-content class="md-dialog-content">',
' <pre>', ' <pre ng-bind-html="data"></pre>',
data,
' </pre>',
' </md-dialog-content>', ' </md-dialog-content>',
' <md-dialog-actions>', ' <md-dialog-actions>',
' <md-button ng-click="close()">' + l('Close') + '</md-button>', ' <md-button ng-click="close()">' + l('Close') + '</md-button>',
' </md-dialog-actions>', ' </md-dialog-actions>',
'</md-dialog>' '</md-dialog>'
].join(''), ].join(''),
controller: ComponentRawSourceDialogController controller: ComponentRawSourceDialogController,
locals: { data: data }
}); });
/** /**
* @ngInject * @ngInject
*/ */
ComponentRawSourceDialogController.$inject = ['scope', '$mdDialog']; ComponentRawSourceDialogController.$inject = ['scope', '$mdDialog', 'data'];
function ComponentRawSourceDialogController(scope, $mdDialog) { function ComponentRawSourceDialogController(scope, $mdDialog, data) {
scope.data = data;
scope.close = function() { scope.close = function() {
$mdDialog.hide(); $mdDialog.hide();
}; };