mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 23:41:23 -03:30
Host events variable parsing to prevent tag inject
The host events modal needs to have escape characters for tag elements in case a user tries to inject html code into the arguements of the host events.
This commit is contained in:
parent
fd86b940e2
commit
9e8ec0ebd0
@ -360,8 +360,6 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
|
||||
event_data.id = event.id;
|
||||
event_data.parent = event.parent;
|
||||
event_data.event = (event.event_display) ? event.event_display : event.event;
|
||||
event_data.msg = event_data.msg.replace(/</g, "<");
|
||||
event_data.msg = event_data.msg.replace(/>/g, ">");
|
||||
results.push(event_data);
|
||||
});
|
||||
if (show_event) {
|
||||
@ -434,6 +432,12 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
|
||||
">" + itm + "</a>";
|
||||
}
|
||||
else {
|
||||
if( typeof itm === "string"){
|
||||
if(itm.indexOf('<') > -1 || itm.indexOf('>') > -1){
|
||||
itm = itm.replace(/</g, "<");
|
||||
itm = itm.replace(/>/g, ">");
|
||||
}
|
||||
}
|
||||
html += "<span ng-non-bindable>" + itm + "</span>";
|
||||
}
|
||||
|
||||
@ -525,6 +529,12 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
|
||||
var id = params.id,
|
||||
val = params.val,
|
||||
html;
|
||||
if( typeof val === "string"){
|
||||
if(val.indexOf('<') > -1 || val.indexOf('>') > -1){
|
||||
val = val.replace(/</g, "<");
|
||||
val = val.replace(/>/g, ">");
|
||||
}
|
||||
}
|
||||
html = "<pre ng-non-bindable>" + val + "</pre>\n";
|
||||
$('#' + id).empty().html(html);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user