XSS character escaping for tooltips

I've added character escaping for tooltips to avoid XSS security breaches
This commit is contained in:
Jared Tabor
2015-01-29 16:19:40 -05:00
parent 71eaa5aa2a
commit 7408387826

View File

@@ -389,7 +389,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
* Include the standard TB data-XXX attributes to controll a tooltip's appearance. We will
* default placement to the left and delay to the config setting.
*/
.directive('awToolTip', function() {
.directive('awToolTip', function($sce) {
return function(scope, element, attrs) {
var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100},
placement;
@@ -409,6 +409,9 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
});
});
attrs.awToolTip = attrs.awToolTip.replace(/</g, "&lt;");
attrs.awToolTip = attrs.awToolTip.replace(/>/g, "&gt;");
attrs.awToolTip = $sce.getTrustedHtml(attrs.awToolTip);
$(element).tooltip({
placement: placement,
delay: delay,