Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enterprise-3.6] Sanitize HTML output for log viewer #327

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dist/origin-web-common-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ angular.module('openshiftCommonUI').factory('GuidedTourService', function() {
;'use strict';

angular.module("openshiftCommonUI")
.factory("HTMLService", function(BREAKPOINTS) {
.factory("HTMLService", function($sanitize, BREAKPOINTS) {
var WINDOW_SIZE_XXS = 'xxs';
var WINDOW_SIZE_XS = 'xs';
var WINDOW_SIZE_SM = 'sm';
Expand Down Expand Up @@ -2003,13 +2003,13 @@ angular.module("openshiftCommonUI")
}

// Replace any URLs with links.
return text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
return $sanitize(text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
if (target) {
return "<a href=\"" + str + "\" target=\"" + target + "\">" + str + "</a>";
}

return "<a href=\"" + str + "\">" + str + "</a>";
});
}));
}
};
});
Expand Down
6 changes: 3 additions & 3 deletions dist/origin-web-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5106,7 +5106,7 @@ angular.module('openshiftCommonUI').factory('GuidedTourService', function() {
;'use strict';

angular.module("openshiftCommonUI")
.factory("HTMLService", ["BREAKPOINTS", function(BREAKPOINTS) {
.factory("HTMLService", ["$sanitize", "BREAKPOINTS", function($sanitize, BREAKPOINTS) {
var WINDOW_SIZE_XXS = 'xxs';
var WINDOW_SIZE_XS = 'xs';
var WINDOW_SIZE_SM = 'sm';
Expand Down Expand Up @@ -5205,13 +5205,13 @@ angular.module("openshiftCommonUI")
}

// Replace any URLs with links.
return text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
return $sanitize(text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
if (target) {
return "<a href=\"" + str + "\" target=\"" + target + "\">" + str + "</a>";
}

return "<a href=\"" + str + "\">" + str + "</a>";
});
}));
}
};
}]);
Expand Down
6 changes: 3 additions & 3 deletions dist/origin-web-common.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ return {
startTour:startTour,
cancelTour:cancelTour
};
}), angular.module("openshiftCommonUI").factory("HTMLService", [ "BREAKPOINTS", function(BREAKPOINTS) {
}), angular.module("openshiftCommonUI").factory("HTMLService", [ "$sanitize", "BREAKPOINTS", function($sanitize, BREAKPOINTS) {
var WINDOW_SIZE_XXS = "xxs", WINDOW_SIZE_XS = "xs", WINDOW_SIZE_SM = "sm", WINDOW_SIZE_MD = "md", WINDOW_SIZE_LG = "lg";
return {
WINDOW_SIZE_XXS:WINDOW_SIZE_XXS,
Expand Down Expand Up @@ -2224,9 +2224,9 @@ return !0;
}
},
linkify:function(text, target, alreadyEscaped) {
return text ? (alreadyEscaped || (text = _.escape(text)), text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
return text ? (alreadyEscaped || (text = _.escape(text)), $sanitize(text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
return target ? '<a href="' + str + '" target="' + target + '">' + str + "</a>" :'<a href="' + str + '">' + str + "</a>";
})) :text;
}))) :text;
}
};
} ]), angular.module("openshiftCommonUI").provider("NotificationsService", function() {
Expand Down
6 changes: 3 additions & 3 deletions src/ui-services/htmlService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module("openshiftCommonUI")
.factory("HTMLService", function(BREAKPOINTS) {
.factory("HTMLService", function($sanitize, BREAKPOINTS) {
var WINDOW_SIZE_XXS = 'xxs';
var WINDOW_SIZE_XS = 'xs';
var WINDOW_SIZE_SM = 'sm';
Expand Down Expand Up @@ -100,13 +100,13 @@ angular.module("openshiftCommonUI")
}

// Replace any URLs with links.
return text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
return $sanitize(text.replace(/https?:\/\/[A-Za-z0-9._%+-]+\S*[^\s.;,(){}<>"\u201d\u2019]/gm, function(str) {
if (target) {
return "<a href=\"" + str + "\" target=\"" + target + "\">" + str + "</a>";
}

return "<a href=\"" + str + "\">" + str + "</a>";
});
}));
}
};
});