User135423268 posted
Good Day Everyone
I have scanned my application using Veracode and I have High findings the which is CWE 80: Cross-Site Scripting
When I check the code, it points out on this code.
$('#table-employee-list tbody').empty();
var listusr = $('#table-employee-list');
$.ajax({
url: '/api/MYAPI/LoadEmployees',
type: 'GET',
contentType: 'application/json charset=utf-8',
dataType: 'json',
success: function (data) {
$.each(data, function (i, item) {
var row = '';
var settblcmd;
settblcmd = '<button type="button" id="row-command" class="btn btn--primary my-table-btn" onclick="createUser(this)" title="Create User">Create User</button>'
row += '<tr>'
+ '<td>' + item.employeeID + '</td>'
+ '<td>' + item.fullName + '</td>'
+ '<td>' + item.position + '</td>'
+ '<td>' + item.dept + '</td>'
+ '<td>' + item.active + '</td>'
+ '<td>' + settblcmd + '</td>'
+ '</tr>'
$('#table-employee-list tbody').append(row);
});
$('#modal-prog-bar').modal('hide');
},
error: function (xhr) {
var getxhr = $.parseJSON(xhr.responseText);
$('#modal-alert').modal({ backdrop: 'static', keyboard: false });
$('#modal-alert-header-title').text("eApps Admin - Error");
$('#alert-message').html(getxhr.message);
$('#close-alert-message').attr('onclick', "$('#modal-alert').modal('hide')");
return;
}
});
It points on the $('#table-employee-list tbody').append(row);
Is there other way to fix this? I have read some of the forums, they always telling that it should be requested for mitigate by design, is this the better fix or there are other ways to fix this?
Thanks everyone, regards.