Skip to content

Commit

Permalink
Fix code scanning alert #514: Client-side cross-site scripting
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent bc503e5 commit 95ae352
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"devDependencies": {
"eslint": "^9.10.0"
},
"dependencies": {
"dompurify": "^3.1.6"
}
}
8 changes: 5 additions & 3 deletions server-data/resources/[esx_addons]/esx_garage/nui/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import DOMPurify from 'dompurify';

$(window).ready(function() {
window.addEventListener('message', function(event) {
const data = event.data;
Expand All @@ -19,12 +21,12 @@ $(window).ready(function() {

if (data.poundCost != undefined) {
$('.content .vehicle-list').html(
getVehicles(data.locales, data.vehiclesList, data.poundCost),
DOMPurify.sanitize(getVehicles(data.locales, data.vehiclesList, data.poundCost)),
);
}
else {
$('.content .vehicle-list').html(
getVehicles(data.locales, data.vehiclesList),
DOMPurify.sanitize(getVehicles(data.locales, data.vehiclesList)),
);
}

Expand All @@ -42,7 +44,7 @@ $(window).ready(function() {
if (data.poundCost) $('#container').data('poundcost', data.poundCost);

$('.impounded_content .vehicle-list').html(
getImpoundedVehicles(data.locales, data.vehiclesImpoundedList),
DOMPurify.sanitize(getImpoundedVehicles(data.locales, data.vehiclesImpoundedList)),
);
$('.impounded_content h2').hide();
}
Expand Down

0 comments on commit 95ae352

Please sign in to comment.