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
- [web] fixed generic avatar in lists (#3719)
- [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)
------------------

View File

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

View File

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