Skip to content

Commit

Permalink
Escape HTML in raw source of events and tasks
Browse files Browse the repository at this point in the history
Fixes #3718
  • Loading branch information
cgx committed Jun 8, 2016
1 parent 97e6385 commit 64ce3c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------
Expand Down
2 changes: 1 addition & 1 deletion UI/Scheduler/UIxComponentEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ - (WOResponse *) rawAction
[content appendFormat: @"%@", [[self clientObject] contentAsString]];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: content];
[response appendContentString: [content stringByEscapingHTMLString]];

return response;
}
Expand Down
12 changes: 6 additions & 6 deletions UI/WebServerResources/js/Scheduler/ComponentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down

2 comments on commit 64ce3c9

@extrafu
Copy link
Contributor

@extrafu extrafu commented on 64ce3c9 Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the same neat stuff should be done when viewing the raw source of a card, and perhaps even a mail.

@cgx
Copy link
Contributor Author

@cgx cgx commented on 64ce3c9 Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed for Cards (1db09de). Mail is OK.

Please sign in to comment.